var WebQuery = {
    storageHandleTree: null,
    storageHandle: null,
    downloadInfoObj: {},
    hMedia: null,
    strDir: null,
    nTotalTime: 0,
    isPauseToPlay: 0,
    videoFileSum: 0,
    tb_tbody: null,
    trCurObj: null,
    reStartTrcurObj: {},
    trHrefInfo: null,
    interval: null,
    intervalLoadFile: null,
    downloadPicPath: {},
    dragMinWidth: 590,
    dragMinHeight: 555,
    windowContainers: new NPCCUtils.Hash(),

    // 获取平台下的所有存储资源
    GetStorageUnitResList:function() {
        var operator = NPCCILY.GetStorageUnitResList(WebClient.connectId);
        if (operator.errorCode == ErrorCode.NP_E_OK) {
            if (operator.value) {
                var platformStorageRes = operator.value;
                return platformStorageRes;
            }
            else {
                alert('平台下没有可用的存储单元，无法进行查询操作');
                return false;
            }

        }
        else {
            alert('获取平台下的所有存储资源失败：' + ErrorCode.Error2Desc(operator.errorCode));
            return false;
        }
    },

    // 查询回放页面，平台 录像 文件（日期信息）
    platformVideoInfoQuery: function(resHandle) {
        var uiDID, strPUID, ucResType, ucResIdx, cameraName;
        //获取设备名称
        var devHandle = NPCCIF.COMMON_GetParent(NPCCILY.Plug.ccPlugin, resHandle).value;
        var deviceName = NPCCIF.COMMON_GetName(NPCCILY.Plug.ccPlugin, devHandle).value;
        var resType = NPCCIF.COMMON_GetResType(NPCCILY.Plug.ccPlugin, resHandle).value;
        // 摄像头
        if (resType == NPCCEnum.ResType.RES_TYPE_CAM) {
            uiDID = NPCCIF.COMMON_GetDID(NPCCILY.Plug.ccPlugin, resHandle).value;
            strPUID = NPCCIF.COMMON_GetPUID(NPCCILY.Plug.ccPlugin, resHandle).value;
            ucResType = resType;
            ucResIdx = NPCCIF.COMMON_GetResIdx(NPCCILY.Plug.ccPlugin, resHandle).value;
            cameraName = NPCCIF.COMMON_GetName(NPCCILY.Plug.ccPlugin, resHandle).value;
        }

        cameraName = deviceName + '-' + cameraName;

        $('#dateInfoPlatTree').css('display', 'block');
        $('#dateInfoPhotoPlatTree').css('display', 'none');
        $('#dateInfoVideoTree').css('display', 'none');
        $('#dateInfoPhotoTree').css('display', 'none');
        $('#dateInfoPlatTree').html('');
        $('.dateInfoVideoTb').css('display', 'block');
        $('.dateInfoPhotoTb').css('display', 'none');
        $('.dateInfoVideoTb tbody').html('');
        var platformHandle = WebQuery.GetStorageUnitResList();
        console.log(platformHandle);

        var uiCount = 15;
        var startPos = 0;
        var fileDateList = [];

        // 查询平台存储文件的日期
        while (uiCount == 15) {
            var operator = NPCCILY.OSS_GetStorageFileDate(WebClient.connectId, platformHandle[0], uiDID, strPUID, parseInt(ucResType),
                parseInt(ucResIdx), NPCCEnum.StreamType.ST_MainStream, startPos, uiCount);
            if (ErrorCode.CLIENT_SUCCEEDED(operator.errorCode)) {
                console.log(operator.value);
                if (operator.value) {
                    for (var i = 0; i < operator.value.length; i++) {
                        fileDateList.push(operator.value[i]);
                    }

                    uiCount = operator.value.length;
                }
                else {
                    $('#dateInfoPlatTree').html('');
                    alert('没有查询到对应的时间消息');
                    return false;
                }

            }
            else {
                $('#dateInfoPlatTree').html('');
                alert('获取存储文件日期失败：' + ErrorCode.Error2Desc(operator.errorCode));
                return false;
            }
        }

        if (fileDateList) {
            var array = fileDateList;
            var yearArr = [];
            for (var i = 0; i < array.length; i++) {
                var resYear = array[i].slice(0, 4);
                if (yearArr.indexOf(resYear) < 0) {
                    yearArr.push(resYear);
                }
            }

            $('#dateInfoPlatTree').css('display', 'block');
            var html = [];
            if ($('#dateInfoPlatTree')[0]) {
                for (var i = 0; i < yearArr.length; i++) {
                    html.push('<li><span class="dateYearName clickName1"></span><span class="clickName" style="padding: 3px;">' + yearArr[i] + '</span>');
                    html.push('<ul>');
                    var monthArr = [];
                    for (var m = 0; m < array.length; m++) {
                        var resYear = array[m].slice(0, 4);
                        if (yearArr[i] == resYear) {
                            var resMonth = array[m].slice(4, 6);
                            if (monthArr.indexOf(resMonth) < 0) {
                                monthArr.push(resMonth);
                            }
                        }
                    }

                    for(var j = 0; j < monthArr.length; j++) {
                        html.push('<li><span class="dateMonthName clickName1"></span><span class="clickName" style="padding: 3px;">' + monthArr[j] + '</span>');
                        html.push('<ul>');
                        var dayArr = [];
                        for (var n = 0; n < array.length; n++) {
                            var resYear = array[n].slice(0, 4);
                            var resMonth = array[n].slice(4, 6);
                            if (yearArr[i] == resYear && monthArr[j] == resMonth) {
                                var resDay = array[n].slice(6, 8);
                                if (dayArr.indexOf(resDay) < 0) {
                                    dayArr.push(resDay);
                                }
                            }
                        }

                        for(var k = 0; k < dayArr.length; k++) {
                            var strDateTime = yearArr[i].concat(monthArr[j]).concat(dayArr[k]).concat('000000');

                            html.push('<li ondblclick="WebQuery.platformVideoFile(\'' + platformHandle[0] + '\', \'' +
                                uiDID + '\', \'' +  strPUID + '\', \'' + ucResType + '\',  \'' + ucResIdx +'\', \'' +
                                cameraName +'\', \'' + strDateTime + '\')">' +
                                '<span class="dateDayName clickName1"></span><span class="clickName" style="padding: 3px;">'+ dayArr[k] +'</span></li>');
                        }

                        html.push('</ul>');
                        html.push('</li>');
                    }

                    html.push('</ul>');
                    html.push('</li>');
                }

                $('#dateInfoPlatTree').html(html.join(''));
                $("#dateInfoPlatTree").treeview();
            }

            $('span.clickName').click(function() {
                $('#dateInfoPlatTree span.clickName').css('background', '');
                $(this).css('background', '#5D9BF0');
            })

            $('span.clickName1').click(function() {
                $('#dateInfoPlatTree span.clickName').css('background', '');
                $(this).next().css('background', '#5D9BF0');
            })
        }
        else {
            $('#dateInfoPlatTree').html('');
            $('.dateInfoVideoTb tbody').html('');
            alert('没有查询到对应的时间消息');
            return false;
        }
    },

    // 获取平台录像文件
    platformVideoFile: function(platformHandle, uiDID, strPUID, ucResType, ucResIdx, cameraName, dateTime) {
        $('#tb_1 tbody').html('');
        var uiOffset = 0;
        var uiCount = 30;
        var fileVideoIndex = 0;
        WebQuery.videoFileRecursion(platformHandle, uiDID, strPUID, ucResType, ucResIdx, cameraName, dateTime, uiOffset, uiCount, fileVideoIndex);
        WebQuery.checkMore('tb_1_tbody', 'tb_1');
    },

    // 获取平台录像文件递归
    videoFileRecursion: function(platformHandle, uiDID, strPUID, ucResType, ucResIdx, cameraName, dateTime, uiOffset, uiCount, fileVideoIndex) {
        var operator = NPCCILY.OSS_GetStorageDateFiles(WebClient.connectId, platformHandle, uiDID,
            strPUID, parseInt(ucResType), parseInt(ucResIdx), dateTime, NPCCEnum.StreamType.ST_MainStream, uiOffset, uiCount);
        console.log(operator);
        if (operator.errorCode == ErrorCode.NP_E_OK || operator.errorCode == ErrorCode.NP_C_E_NEED_CONTINUE) {
            WebQuery.platformFileVideoInfoTable(fileVideoIndex, operator.value, dateTime, platformHandle, ucResIdx, cameraName);
            setTimeout(function() {
                fileVideoIndex += 30;
                uiCount = operator.value.length;
                uiOffset += uiCount;
                if (uiCount == 30) {
                    WebQuery.videoFileRecursion(platformHandle, uiDID, strPUID, ucResType, ucResIdx, cameraName, dateTime, uiOffset, uiCount, fileVideoIndex);
                }
            }, 1000);
        }
        else {
            $('#dateInfoPlatTree').html('');
            $('.dateInfoVideoTb tbody').html('');
            alert('获取录像文件失败：' + ErrorCode.Error2Desc(operator.errorCode));
            return false;
        }
    },

    // 每获取一次录像信息，将其信息填入表格
    platformFileVideoInfoTable: function(fileVideoIndex, videoFileInfo, dateTime, platformHandle, ucResIdx, cameraName) {
        if (videoFileInfo.length) {
            var html = [];
            $.each(videoFileInfo, function(baseVideoIdx, baseVideo) {
                var startTime = baseVideo.strStartTime.slice(0, 4) + '-' + baseVideo.strStartTime.slice(4, 6) + '-' +
                    baseVideo.strStartTime.slice(6, 8) + ' ' + baseVideo.strStartTime.slice(8, 10) + ':' +
                    baseVideo.strStartTime.slice(10, 12) + ':' +baseVideo.strStartTime.slice(12, 14);

                var endTime = baseVideo.strEndTime.slice(0, 4) + '-' + baseVideo.strEndTime.slice(4, 6) + '-' +
                    baseVideo.strEndTime.slice(6, 8) + ' ' + baseVideo.strEndTime.slice(8, 10) + ':' +
                    baseVideo.strEndTime.slice(10, 12) + ':' +baseVideo.strEndTime.slice(12, 14);

                var videoTag;
                var reg = new RegExp("[\\u4E00-\\u9FFF]+","g");
                if (reg.test(baseVideo.straReason[0])) {
                    videoTag = baseVideo.straReason[0];
                }
                else if (baseVideo.straReason[0] == 'Manual') {
                    videoTag = '手动录像';
                }
                else if (baseVideo.straReason[0] == 'Upload') {
                    videoTag = '上传录像';
                }
                else if (baseVideo.straReason[0].slice(0, 10) == 'LinkAction') {
                    videoTag = '联动录像';
                }
                else {
                    videoTag = baseVideo.straReason[0];
                }
                var pathFile = baseVideo.strFilePath;
                var pathFileAll = pathFile + baseVideo.strFileName;
                var date = 'Storage\\' + dateTime.slice(2,6) + '\\' + dateTime.slice(6,8);
                fileVideoIndex++;
                html.push('<tr href="' + platformHandle + '&&' + pathFileAll + '&&' + baseVideo.strFileName + '&&' + cameraName +
                    '&&' + ucResIdx + '&&' + '' + '&&' + baseVideo.uiFileSize + '&&' + date + '" ondblclick="WebQuery.dblPlayVideoFile(\'tb_1_tbody\')" onClick="WebQuery.changeIndex(\'tb_1\');" ' +
                    'oncontextmenu="WebQuery.rightButton(event, \'tb_1_tbody\', \'tb_1\', \'platformVideo\')"><td>' +
                    '<span style="display: inline-block;width: 16px; height: 16px;margin-right: 3px;vertical-align: middle;' +
                    'background: url(Image/indexImage/CommandList16.png) no-repeat -624px 0px;"></span>' + fileVideoIndex + '</td>');
                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + baseVideo.strFileName + '</td>');
                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + (baseVideo.uiFileSize / 1024 / 1024).toFixed(1) + 'MB' + '</td>');
                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + startTime + '</td>');
                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + endTime + '</td>');
                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + videoTag + '</td>');
                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + cameraName + '</td>');
                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + pathFile + '</td>');
                html.push('</tr>');
            })

            $('#tb_1 tbody').append(html.join(''));
        }
    },

    // 查询回放 录像文件 本地  日期
    localVideoDateInfo: function(html, strDir) {
        //首先判断该目录是否存在
        var operator = NPCCIF.Util_IsDirExist(NPCCILY.Plug.ccPlugin, NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strDir)));
        if (operator.errorCode !== ErrorCode.NP_E_OK) {
            return;
        }

        var array = [];
        // 获得一个目录下的子目录列表
        var operator = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin, NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strDir)));
        if (operator.errorCode == ErrorCode.NP_E_OK) {
            if (operator.value) {
                for (var i = 0; i < operator.value.length; i++) {
                    if ($('#dateInfoVideoTree')[0]) {
                        var arr0 = operator.value[i].split('\\');
                        var dateName0 = arr0[arr0.length - 2];
                        html.push('<li><span class="localDateFile clickNameIcon"></span>' +
                            '<span class="clickName rootRomainNameInfo">' + dateName0 + '</span>');
                        html.push('<ul>');
                        var operatorOne = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin, NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(operator.value[i])));
                        if (operatorOne.errorCode == ErrorCode.NP_E_OK) {
                            if (operatorOne.value) {
                                for (var j = 0; j < operatorOne.value.length; j++) {
                                    var operatorTwo = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin,
                                        NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(operatorOne.value[j])));
                                    if (operatorTwo.errorCode == ErrorCode.NP_E_OK) {
                                        if (operatorTwo.value) {
                                            for (var k = 0; k < operatorTwo.value.length; k++) {
                                                var operatorThree = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin,
                                                    NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(operatorTwo.value[k])));
                                                if (operatorThree.errorCode == ErrorCode.NP_E_OK) {
                                                    if (operatorThree.value) {
                                                        for (var m = 0; m < operatorThree.value.length; m++) {
                                                            //获得一个目录下的文件列表
                                                            var operatorFour = NPCCIF.Util_GetFiles(NPCCILY.Plug.ccPlugin,
                                                                NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(
                                                                    NPCCUtils.UTF8toUnicode(operatorThree.value[m]))), '*.rav');
                                                            if (operatorFour.value) {
                                                                //从全路径名中取出文件名信息
                                                                var operatorFive = NPCCIF.Util_PathNameToName(NPCCILY.Plug.ccPlugin,
                                                                    NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(NPCCUtils.UTF8toUnicode(operatorFour.value[0]))));
                                                                //从全路径名中取出路径信息
                                                                var operatorSix = NPCCIF.Util_PathNameToPath(NPCCILY.Plug.ccPlugin,
                                                                    NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(NPCCUtils.UTF8toUnicode(operatorThree.value[m]))));
                                                                var arr = operatorOne.value[j].split('\\');
                                                                var dateName = arr[arr.length - 2] + '';
                                                                var arr1 = operatorTwo.value[k].split('\\');
                                                                var dateName1 = arr1[arr1.length - 2] + '';
                                                                array.push(dateName + dateName1);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var arrayYear = [];
                            for (var i = 0; i < array.length; i++) {
                                var resYearMonth = array[i].slice(0, 4);
                                if (arrayYear.indexOf(resYearMonth) < 0) {
                                    arrayYear.push(resYearMonth);
                                }
                            }

                            for (var i = 0; i < arrayYear.length; i++) {
                                html.push('<li><span class="localDateFile clickNameIcon"></span>' +
                                    '<span class="clickName">' + arrayYear[i] + '</span>');
                                html.push('<ul>');
                                var arrayDay = [];
                                for (var m = 0; m < array.length; m++) {
                                    var resYearMonth = array[m].slice(0, 4);
                                    if (arrayYear[i] == resYearMonth) {
                                        var resDay = array[m].slice(4, 6);
                                        if (arrayDay.indexOf(resDay) < 0) {
                                            arrayDay.push(resDay);
                                        }
                                    }
                                }

                                for(var j = 0; j < arrayDay.length; j++) {
                                    html.push('<li class="clickedChangeBgcolor" ondblclick="WebQuery.localStorageFileInfo(\'' + dateName0 + '\', \'' +
                                        arrayYear[i] +'\', \'' + arrayDay[j] +'\')"><span class="localDateFile clickNameIcon"></span>' +
                                        '<span class="clickName">' + arrayDay[j] + '</span></li>');
                                }

                                html.push('</ul>');
                                html.push('</li>');
                            }

                            html.push('</ul>');
                            html.push('</li>');
                        }

                        $('#dateInfoVideoTree').html(html.join(''));
                        // $("#dateInfoVideoTree").treeview();
                        $('#dateInfoVideoTree').treeview({
                            collapsed: true
                        });

                        $('#dateInfoVideoTree span.rootRomainNameInfo').trigger("dblclick");
                    }

                    $('#dateInfoVideoTree span.clickName').click(function () {
                        $('#dateInfoVideoTree span.clickName').css('background', '');
                        $(this).css('background', '#5D9BF0');
                    })

                    $('#dateInfoVideoTree span.clickNameIcon').click(function () {
                        $('#dateInfoVideoTree span.clickName').css('background', '');
                        $(this).next().css('background', '#5D9BF0');
                    })

                    $('#dateInfoVideoTree li.clickedChangeBgcolor').click(function() {
                        $('#dateInfoVideoTree span.clickName').css('background', '');
                        $(this).children('span.clickName').css('background', '#5D9BF0');
                    })
                }
            }
            else {
            }
        }
        else {
            // alert('获取子目录列表失败：' + ErrorCode.Error2Desc(operator.errorCode));
            return false;
        }
    },

    // 查询回放 录像文件 本地  录像文件
    localStorageFileInfo: function(storage, yearMonth, day) {
        $('.dateInfoPhotoTb').css('display', 'none');
        $('#tb_1 tbody').html('');
        $('.dateInfoVideoTb').css({
            'display': 'block',
            'width': '100%'
        });

        var strDirNew = WebClient.strDir + storage + '\\' + yearMonth + '\\' + day + '\\';
        // 获得一个目录下的子目录列表
        var operator = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin,
            NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strDirNew)));
        if (operator.errorCode == ErrorCode.NP_E_OK) {
            var html = [];
            var fileVideoIndex = 0;
            if (operator.value) {
                for (var m = 0; m < operator.value.length; m++) {
                    //获得录像文件信息
                    var operatorInfo = NPCCIF.RSTW_QueryLocalFile(NPCCILY.Plug.ccPlugin,
                        NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(NPCCUtils.UTF8toUnicode(operator.value[m]))), '*.rav');
                    if (operatorInfo.errorCode == ErrorCode.NP_E_OK) {
                        console.log(operatorInfo.value[0]);
                        if (operatorInfo.value[0]) {
                            var arr = (operatorInfo.value[0].FilePath + '').split('\\');
                            var cameraInfo = (arr[arr.length - 2] + '').split('_')[0] + '-' + (operatorInfo.value[0].FileName + '').split('_')[0];
                            var pathAll = operatorInfo.value[0].FilePath + operatorInfo.value[0].FileName + '&&' +  operatorInfo.value[0].FileName + '&&' + cameraInfo;
                            fileVideoIndex++;
                            html.push('<tr href="' + pathAll + '" onClick="WebQuery.changeIndex(\'tb_1\');" ' +
                                'ondblclick="WebQuery.dblPlayVideoFile(\'tb_1_tbody\')" oncontextmenu="WebQuery.rightButton(event, \'tb_1_tbody\', \'tb_1\')"><td>' +
                                '<span style="display: inline-block;width: 16px; height: 16px;margin-right: 3px; vertical-align: middle;' +
                                'background: url(Image/indexImage/CommandList16.png) no-repeat -624px 0px;"></span>' + fileVideoIndex + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + operatorInfo.value[0].FileName + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + WebQuery.calcFileSize(operatorInfo.value[0].FileSize) + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + operatorInfo.value[0].StartTime + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + operatorInfo.value[0].EndTime + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + '本地录像' + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + cameraInfo + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + operatorInfo.value[0].FilePath + '</td>');
                            html.push('</tr>');
                        }
                    }
                }
            }

            $('.dateInfoVideoTb').css('overflow', 'auto');
            $('#tb_1 tbody').html(html.join(''));
        }

        WebQuery.checkMore('tb_1_tbody', 'tb_1');
    },

    // 计算录像文件大小
    calcFileSize: function(fileSize) {
        var fileSizeInfo, judgeSize;
        judgeSize = (fileSize / 1024).toFixed(1);
        if (judgeSize < 1000) {
            fileSizeInfo = judgeSize + 'KB';
        }
        else if (judgeSize >= 1000) {
            judgeSize = (fileSize / 1024 / 1024).toFixed(1);
            if (judgeSize < 1000) {
                fileSizeInfo = judgeSize + 'MB';
            }
            else if (judgeSize >= 1000) {
                fileSizeInfo = (fileSize / 1024 / 1024).toFixed(1) + 'GB';
            }
        }

        return fileSizeInfo;
    },

    //双击打开录像文件
    dblPlayVideoFile: function(tb_tbody) {
        // 创建滚动条
        // createProgress();
        // 视频回放
        if ($('#dragVideo').css('display') == 'block') {
            if (WebQuery.hMedia != null) {
                var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
                var winObj = windowContainerStruct.window;
                // 停止回放本地录像
                var operator = NPCCIF.StopReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                winObj.status.playvideoing = false;
                //刷新最后一帧画面
                operator = NPCCIF.RefreshImage(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                //关闭回放本地录像
                operator = NPCCIF.CloseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                WebQuery.nTotalTime = 0;
                WebQuery.hMedia = null;
            }

            $('a.butt_progress').slider('option', 'value', 0);
            $('.butt_playOrPause').css('display', 'inline-block');
            $('.butt_pauseToPlay').css('display', 'none');
            $('.butt_pause').css('opacity', '1');
            $('.butt_slow').css('opacity', '1');
            $('.butt_speed').css('opacity', '1');
            $('.butt_pauseToPlayAudioOne').css('display', 'none');
            $('.butt_playOrPauseAudioOne').css('display', 'inline-block');
            $('.butt_pauseToPlayAudioTwo').css('display', 'none');
            $('.butt_playOrPauseAudioTwo').css('display', 'inline-block');
            $('.butt_playOrPauseAudioOne').css('opacity', '1');
            $('.butt_playOrPauseAudioTwo').css('opacity', '1');
            $('.butt_pauseToPlayAudioOne').css('opacity', '1');
            $('.butt_pauseToPlayAudioTwo').css('opacity', '1');
            $('.butt_snapshot').css('opacity', '1');
            $('.butt_rotate').css('opacity', '1');
            $('.butt_fullScreen').css('opacity', '1');
        }

        var alarmIndex = parseInt($('#alarmEventList').css('z-index'));
        var loadIndex = parseInt($('#loadManage').css('z-index'));
        $('#dragVideo').css('z-index', (alarmIndex - loadIndex) >= 0 ? (alarmIndex + 1) : (loadIndex + 1));

        $('#dragVideo').css('display', 'block');
        $('.dragVideo_content').css('display', 'block');
        $('.dragVideo_content').css('background', '#000');
        $('#content_videoPlay').css('background', '#000');
        WebQuery.windowContainers.set('content_videoPlay', new NPCCStruct.WindowContainerStruct('content_videoPlay', false, null, null));

        WebQuery.createVideoWindow('content_videoPlay');

        var oDrag = document.getElementById('dragVideo');
        oDrag.style.left = (document.documentElement.clientWidth - oDrag.offsetWidth) / 2 + 'px';
        oDrag.style.top = (document.documentElement.clientHeight - oDrag.offsetHeight) / 2 + 'px';

        WebQuery.callBackVideoResize();

        WebQuery.playVideoFile_enabled();
        WebQuery.tb_tbody = tb_tbody;
        WebQuery.nTotalTime = 0;
        clearInterval(WebQuery.interval);
        WebQuery.playVideoInfo(tb_tbody);
    },

    // 查询回放 图片文件 平台 对应的日期信息
    platformInfoPhotoQuery: function(resHandle) {
        var uiDID, strPUID, ucResType, ucResIdx, cameraName;
        var resType = NPCCIF.COMMON_GetResType(NPCCILY.Plug.ccPlugin, resHandle).value;
        if (resType == NPCCEnum.ResType.RES_TYPE_CAM) { // 摄像头
            uiDID = NPCCIF.COMMON_GetDID(NPCCILY.Plug.ccPlugin, resHandle).value;
            strPUID = NPCCIF.COMMON_GetPUID(NPCCILY.Plug.ccPlugin, resHandle).value;
            ucResType = resType;
            ucResIdx = NPCCIF.COMMON_GetResIdx(NPCCILY.Plug.ccPlugin, resHandle).value;
            cameraName = NPCCIF.COMMON_GetName(NPCCILY.Plug.ccPlugin, resHandle).value;
        }
        var devHandle = NPCCIF.COMMON_GetParent(NPCCILY.Plug.ccPlugin, resHandle).value;
        var deviceName = NPCCIF.COMMON_GetName(NPCCILY.Plug.ccPlugin, devHandle).value;
        cameraName = deviceName + '-' + cameraName;

        $('#dateInfoPlatTree').css('display', 'none');
        $('#dateInfoPhotoPlatTree').css('display', 'block');
        $('#dateInfoVideoTree').css('display', 'none');
        $('#dateInfoPhotoTree').css('display', 'none');
        $('#dateInfoPhotoPlatTree').html('');
        $('.dateInfoVideoTb').css('display', 'none');
        $('.dateInfoPhotoTb').css('display', 'block');
        $('.dateInfoPhotoTb tbody').html('');

        var platformHandle = WebQuery.GetStorageUnitResList();
        var uiCount = 15;
        var startPos = 0;
        var fileDateList = [];
        // 查询平台存储图片的日期
        while (uiCount == 15) {
            var operator = NPCCILY.OSS_GetStorageFileDate(WebClient.connectId, platformHandle[0], uiDID, strPUID, parseInt(ucResType),
                parseInt(ucResIdx), NPCCEnum.StreamType.ST_Picture, startPos, uiCount);
            if (ErrorCode.CLIENT_SUCCEEDED(operator.errorCode)) {
                console.log(operator.value);
                if (operator.value) {
                    for (var i = 0; i < operator.value.length; i++) {
                        fileDateList.push(operator.value[i]);
                    }

                    uiCount = operator.value.length;
                }
                else {
                    $('#dateInfoPhotoPlatTree').html('');;
                    alert('没有查询到对应的时间信息');
                    return false;
                }
            }
            else {
                $('#dateInfoPhotoPlatTree').html('');
                if (operator.errorCode == ErrorCode.NP_E_PU_OFFLINE) {
                    alert('查询时间信息失败，路由失败');
                }
                else {
                    alert('查询时间信息失败，' + ErrorCode.Error2Desc(operator.errorCode));
                }

                return false;
            }
        }

        if (fileDateList) {
            var array = fileDateList;
            var yearArr = [];
            for (var i = 0; i < array.length; i++) {
                var resYear = array[i].slice(0, 4);
                if (yearArr.indexOf(resYear) < 0) {
                    yearArr.push(resYear);
                }
            }
            $('#dateInfoPhotoPlatTree').css('display', 'block');
            var html = [];
            if ($('#dateInfoPhotoPlatTree')[0]) {
                for (var i = 0; i < yearArr.length; i++) {
                    html.push('<li><span class="dateYearName clickNameIcon"></span>' +
                        '<span class="clickName rootRomainNameInfo">' + yearArr[i] + '年</span>');
                    html.push('<ul>');
                    var monthArr = [];
                    for (var m = 0; m < array.length; m++) {
                        var resYear = array[m].slice(0, 4);
                        if (yearArr[i] == resYear) {
                            var resMonth = array[m].slice(4, 6);
                            if (monthArr.indexOf(resMonth) < 0) {
                                monthArr.push(resMonth);
                            }
                        }
                    }

                    for(var j = 0; j < monthArr.length; j++) {
                        html.push('<li><span class="dateMonthName clickNameIcon"></span>' +
                            '<span class="clickName">' + monthArr[j] + '月</span>');
                        html.push('<ul>');
                        var dayArr = [];
                        for (var n = 0; n < array.length; n++) {
                            var resYear = array[n].slice(0, 4);
                            var resMonth = array[n].slice(4, 6);
                            if (yearArr[i] == resYear && monthArr[j] == resMonth) {
                                var resDay = array[n].slice(6, 8);
                                if (dayArr.indexOf(resDay) < 0) {
                                    dayArr.push(resDay);
                                }
                            }
                        }

                        for(var k = 0; k < dayArr.length; k++) {
                            var strDateTime = yearArr[i].concat(monthArr[j]).concat(dayArr[k]).concat('000000');
                            html.push('<li class="clickedChangeBgcolor" ondblclick="WebQuery.platformFilePhotoInfo(\'' + platformHandle[0] + '\', \'' +
                                uiDID + '\', \'' +  strPUID + '\', \'' + ucResType + '\',  \'' + ucResIdx + '\', \'' +
                                cameraName + '\', \'' + strDateTime + '\')">' +
                                '<span class="dateDayName clickNameIcon"></span>' +
                                '<span class="clickName">'+ dayArr[k] +'日</span></li>');
                        }

                        html.push('</ul>');
                        html.push('</li>');
                    }

                    html.push('</ul>');
                    html.push('</li>');
                }

                $('#dateInfoPhotoPlatTree').html(html.join(''));
                // $('#platformPhotoDateInfoTree').treeview();
                $('#dateInfoPhotoPlatTree').treeview({
                    collapsed: true
                });

                $('#dateInfoPhotoPlatTree span.rootRomainNameInfo').trigger("dblclick");
            }

            $('span.clickName').click(function() {
                $('#dateInfoPhotoPlatTree span.clickName').css('background', '');
                $(this).css('background', '#5D9BF0');
            })

            $('span.clickName1').click(function() {
                $('#dateInfoPhotoPlatTree span.clickName').css('background', '');
                $(this).next().css('background', '#5D9BF0');
            })
        }
    },

    // 获取平台图片文件
    platformFilePhotoInfo: function(platformHandle, uiDID, strPUID, ucResType, ucResIdx, cameraName, dateTime) {
        $('#tb_2_tbody').html('');
        var uiOffset = 0, fileVideoIndex = 0;
        var uiCount = 50;
        WebQuery.photoFileRecursion(platformHandle, uiDID, strPUID, ucResType, ucResIdx, cameraName, dateTime, uiOffset, uiCount, fileVideoIndex);

        WebQuery.checkMore('tb_2_tbody', 'tb_2');
    },

    // 获取平台图片文件递归
    photoFileRecursion: function(platformHandle, uiDID, strPUID, ucResType, ucResIdx, cameraName, dateTime, uiOffset, uiCount, fileVideoIndex) {
        var operator = NPCCILY.OSS_GetStorageDateFiles(WebClient.connectId, platformHandle, uiDID,
            strPUID, parseInt(ucResType), parseInt(ucResIdx), dateTime, NPCCEnum.StreamType.ST_Picture, uiOffset, uiCount);
        if (operator.errorCode == ErrorCode.NP_E_OK || operator.errorCode == ErrorCode.NP_C_E_NEED_CONTINUE) {
            WebQuery.platformFilePhotoInfoTable(fileVideoIndex, operator.value, dateTime, platformHandle, ucResIdx, cameraName);
            setTimeout(function() {
                fileVideoIndex += 50;
                uiCount = operator.value.length;
                uiOffset += uiCount;
                if (uiCount == 50) {
                    WebQuery.photoFileRecursion(platformHandle, uiDID, strPUID, ucResType, ucResIdx, cameraName, dateTime, uiOffset, uiCount, fileVideoIndex);
                }
            }, 1000);
        }
        else {
            $('#dateInfoPhotoPlatTree').html('');
            $('.dateInfoPhotoTb tbody').html('');
            alert('获取图片文件失败：' + ErrorCode.Error2Desc(operator.errorCode));
            return false;
        }
    },

    // 每获取一次图片信息，将其信息填入表格
    platformFilePhotoInfoTable: function(fileVideoIndex, videoFileInfo, dateTime, platformHandle, ucResIdx, cameraName) {
        var html = [];
        $.each(videoFileInfo, function(baseVdragVideo_contentideoIdx, baseVideo) {
            var startTime = baseVideo.strStartTime.slice(0, 4) + '-' + baseVideo.strStartTime.slice(4, 6) + '-' +
                baseVideo.strStartTime.slice(6, 8) + ' ' + baseVideo.strStartTime.slice(8, 10) + ':' +
                baseVideo.strStartTime.slice(10, 12) + ':' +baseVideo.strStartTime.slice(12, 14);

            var endTime = baseVideo.strEndTime.slice(0, 4) + '-' + baseVideo.strEndTime.slice(4, 6) + '-' +
                baseVideo.strEndTime.slice(6, 8) + ' ' + baseVideo.strEndTime.slice(8, 10) + ':' +
                baseVideo.strEndTime.slice(10, 12) + ':' +baseVideo.strEndTime.slice(12, 14);

            var videoTag;
            var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
            if (!baseVideo.straReason.length) {
                videoTag = '';
            }
            else if (reg.test(baseVideo.straReason[0])) {
                videoTag = baseVideo.straReason[0];
            }
            else if (baseVideo.straReason[0] == 'Manual') {
                videoTag = '本地抓拍';
            }
            else if (baseVideo.straReason[0] == 'Upload') {
                videoTag = '本地上传';
            }
            else if (baseVideo.straReason[0].slice(0, 10) == 'LinkAction') {
                videoTag = '联动抓拍';
            }

            var pathFileAll = baseVideo.strFilePath + baseVideo.strFileName;
            var date = 'Storage\\' + dateTime.slice(2,6) + '\\' + dateTime.slice(6,8);
            fileVideoIndex++;
            html.push('<tr href="' + platformHandle + '&&' + pathFileAll + '&&' + baseVideo.strFileName +  '&&'
                + cameraName +'&&' + ucResIdx + '&&' + '' + '&&' + baseVideo.uiFileSize + '&&' + date + '" ' +
                'ondblclick="WebQuery.dblPlayPhotoFile(\'tb_2_tbody\')"  ' +
                'onClick="WebQuery.changeIndex(\'tb_2\');" oncontextmenu="WebQuery.rightButton(event, \'tb_2_tbody\', \'tb_2\')"><td>' +
                '<span style="display: inline-block;width: 16px; height: 16px;margin-right: 3px;vertical-align: middle;' +
                'background: url(Image/indexImage/CommandList16.png) no-repeat -640px 0px;"></span>' + fileVideoIndex + '</td>');
            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + baseVideo.strFileName + '</td>');
            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + WebQuery.calcFileSize(baseVideo.uiFileSize) + '</td>');
            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + startTime + '</td>');
            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + videoTag + '</td>');
            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + cameraName + '</td>');
            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + baseVideo.strFilePath + '</td>');
            html.push('</tr>');
        })

        $('.dateInfoPhotoTb').css('overflow', 'auto');
        $('#tb_2 tbody').append(html.join(''));
    },

    // 查询回放 图片文件 本地  日期
    localPhotoDateInfo: function(html, strDir) {
        //首先判断该目录是否存在
        var operator = NPCCIF.Util_IsDirExist(NPCCILY.Plug.ccPlugin, NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strDir)));
        // alert(operator.errorCode);
        if (operator.errorCode !== ErrorCode.NP_E_OK) {
            return;
        }

        var array = [];
        // 获得一个目录下的子目录列表
        var operator = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin, NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strDir)));
        if (operator.errorCode == ErrorCode.NP_E_OK) {
            if (operator.value) {
                for (var i = 0; i < operator.value.length; i++) {
                    if ($('#dateInfoPhotoTree')[0]) {
                        var arr0 = operator.value[i].split('\\');
                        var dateName0 = arr0[arr0.length - 2];
                        html.push('<li><span class="localDateFile clickNameIcon"></span>' +
                            '<span class="clickName rootRomainNameInfo">' + dateName0 + '</span>');
                        html.push('<ul>');
                        var operatorOne = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin, NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(operator.value[i])));
                        if (operatorOne.errorCode == ErrorCode.NP_E_OK) {
                            if (operatorOne.value) {
                                for (var j = 0; j < operatorOne.value.length; j++) {
                                    var operatorTwo = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin,
                                        NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(operatorOne.value[j])));
                                    if (operatorTwo.errorCode == ErrorCode.NP_E_OK) {
                                        if (operatorTwo.value) {
                                            for (var k = 0; k < operatorTwo.value.length; k++) {
                                                var operatorThree = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin,
                                                    NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(operatorTwo.value[k])));
                                                if (operatorThree.errorCode == ErrorCode.NP_E_OK) {
                                                    if (operatorThree.value) {
                                                        for (var m = 0; m < operatorThree.value.length; m++) {
                                                            //获得一个目录下的文件列表
                                                            var operatorFour = NPCCIF.Util_GetFiles(NPCCILY.Plug.ccPlugin,
                                                                NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(NPCCUtils.UTF8toUnicode(operatorThree.value[m]))), '*.jpg|*.bmp');
                                                            if (operatorFour.value) {
                                                                //从全路径名中取出文件名信息
                                                                var operatorFive = NPCCIF.Util_PathNameToName(NPCCILY.Plug.ccPlugin,
                                                                    NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(NPCCUtils.UTF8toUnicode(operatorFour.value[0]))));
                                                                //从全路径名中取出路径信息
                                                                var operatorSix = NPCCIF.Util_PathNameToPath(NPCCILY.Plug.ccPlugin,
                                                                    NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(NPCCUtils.UTF8toUnicode(operatorThree.value[m]))));
                                                                var arr = operatorOne.value[j].split('\\');
                                                                var dateName = arr[arr.length - 2] + '';
                                                                var arr1 = operatorTwo.value[k].split('\\');
                                                                var dateName1 = arr1[arr1.length - 2] + '';
                                                                array.push(dateName + dateName1);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }

                                }
                            }

                            var arrayYear = [];
                            for (var i = 0; i < array.length; i++) {
                                var resYearMonth = array[i].slice(0, 4);
                                if (arrayYear.indexOf(resYearMonth) < 0) {
                                    arrayYear.push(resYearMonth);
                                }
                            }

                            for (var i = 0; i < arrayYear.length; i++) {
                                html.push('<li><span class="localDateFile clickNameIcon"></span>' +
                                    '<span class="clickName">' + arrayYear[i] + '</span>');
                                html.push('<ul>');
                                var arrayDay = [];
                                for (var m = 0; m < array.length; m++) {
                                    var resYearMonth = array[m].slice(0, 4);
                                    if (arrayYear[i] == resYearMonth) {
                                        var resDay = array[m].slice(4, 6);
                                        if (arrayDay.indexOf(resDay) < 0) {
                                            arrayDay.push(resDay);
                                        }
                                    }
                                }

                                for(var j = 0; j < arrayDay.length; j++) {
                                    html.push('<li class="clickedChangeBgcolor" ondblclick="WebQuery.localPhotoStorageFileInfo(\'' + dateName0 + '\', \'' +
                                        arrayYear[i] + '\', \'' + arrayDay[j] + '\')"><span class="localDateFile clickNameIcon"></span>' +
                                        '<span class="clickName">' + arrayDay[j] + '</span></li>');
                                }

                                html.push('</ul>');
                                html.push('</li>');
                            }

                            html.push('</ul>');
                            html.push('</li>');
                        }

                        $('#dateInfoPhotoTree').html(html.join(''));
                        // $('#dateInfoPhotoTree').treeview();
                        $('#dateInfoPhotoTree').treeview({
                            collapsed: true
                        });

                        $('#dateInfoPhotoTree span.rootRomainNameInfo').trigger("dblclick");
                    }

                    $('#dateInfoPhotoTree span.clickName').click(function () {
                        $('#dateInfoPhotoTree span.clickName').css('background', '');
                        $(this).css('background', '#5D9BF0');
                    })

                    $('#dateInfoPhotoTree span.clickNameIcon').click(function () {
                        $('#dateInfoPhotoTree span.clickName').css('background', '');
                        $(this).next().css('background', '#5D9BF0');
                    })

                    $('#dateInfoPhotoTree li.clickedChangeBgcolor').click(function() {
                        $('#dateInfoPhotoTree span.clickName').css('background', '');
                        $(this).children('span.clickName').css('background', '#5D9BF0');
                    })

                }
            }
            else {

            }
        }
        else {
            return false;
        }
    },

    // 查询回放 图片文件 本地  图片信息
    localPhotoStorageFileInfo: function(storage, yearMonth, day) {
        $('.dateInfoVideoTb').css('display', 'none');
        $('#tb_2 tbody').html('');
        $('.dateInfoPhotoTb').css({
            'display': 'block',
            'width': '100%'
        });

        var strDirNew = WebClient.strDir + storage + '\\' + yearMonth + '\\' + day + '\\';

        var operatorThree = NPCCIF.Util_GetSubDirs(NPCCILY.Plug.ccPlugin,
            NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strDirNew)));
        if (operatorThree.errorCode == ErrorCode.NP_E_OK) {
            var html = [];
            var fileVideoIndex = 0;
            if (operatorThree.value) {
                for (var m = 0; m < operatorThree.value.length; m++) {
                    var operatorInfo = NPCCIF.RSTW_QueryLocalFile(NPCCILY.Plug.ccPlugin,
                        NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(NPCCUtils.UTF8toUnicode(operatorThree.value[m]))), '*.jpg|*.bmp');
                    console.log(operatorInfo.value[0]);
                    if (operatorInfo.errorCode == ErrorCode.NP_E_OK) {
                        if (operatorInfo.value[0]) {
                            var arr = (operatorInfo.value[0].FilePath + '').split('\\');
                            var cameraInfo = (arr[arr.length - 2] + '').split('_')[0] + '-' + (operatorInfo.value[0].FileName + '').split('_')[0];
                            var pathAll = operatorInfo.value[0].FilePath + operatorInfo.value[0].FileName;
                            fileVideoIndex++;
                            html.push('<tr href="' + pathAll + '" ondblclick="WebQuery.dblPlayPhotoFile(\'tb_2_tbody\')"' +
                                ' onClick="WebQuery.changeIndex(\'tb_2\');" oncontextmenu="WebQuery.rightButton(event, \'tb_2_tbody\', \'tb_2\')"><td>' +
                                '<span style="display: inline-block;width: 16px; height: 16px;margin-right: 3px; vertical-align: middle;' +
                                'background: url(Image/indexImage/CommandList16.png) no-repeat -640px 0px;"></span>' + fileVideoIndex + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + operatorInfo.value[0].FileName + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + WebQuery.calcFileSize(operatorInfo.value[0].FileSize) + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + operatorInfo.value[0].StartTime + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + '本地抓拍' + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + cameraInfo + '</td>');
                            html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">'+ operatorInfo.value[0].FilePath + '</td>');
                            html.push('</tr>');
                        }
                    }
                }
            }

            $('.dateInfoPhotoTb').css('overflow', 'auto');
            $('#tb_2 tbody').html(html.join(''));
        }
        $('.dateInfoPhotoTb').css('overflow', 'auto');
        WebQuery.checkMore('tb_2_tbody', 'tb_2');
    },

    //双击打开图片文件(非本地先下载再打开)
    dblPlayPhotoFile: function (tb_tbody) {
        var platformOrLocalSelectText = $("#platformOrLocalSel").find("option:selected").text();
        if (platformOrLocalSelectText == '平台') {
            //平台双击打开图片文件，先下载再打开
            WebQuery.loadVideoOrPictureFile(tb_tbody, NPCCEnum.checkOrLoadPhoto.checkPhoto);
        }
        else {
            //本地双击打开图片文件
            var picPathArray = [];
            $('#' + tb_tbody + ' tr').each(function() {
                var rgb = $(this).css('background-color');
                rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
                function hex(x) {
                    return ('0' + parseInt(x).toString(16)).slice(-2);
                }

                rgb = '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
                if (rgb.toUpperCase() == '#B4C9E9') {
                    //获取有背景颜色的tr
                    var hrefInfo = $(this).attr('href');
                    var hrefInfoRes = hrefInfo.split('&&');
                    var strPath = hrefInfoRes[0];
                    picPathArray.push(NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strPath)));
                }
            })

            var operator = NPCCIF.RSTW_Util_ExecuteFile(NPCCILY.Plug.ccPlugin, picPathArray[0]);
        }
    },

    // 回放点播录像文件按钮使能状态
    playVideoFile_enabled: function() {
        var operator;// 停止播放
        $('a.butt_pause').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -192px 0px');
        $('a.butt_pause').bind('mouseover.pause', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -224px 0px');
        })

        $('a.butt_pause').bind('mouseout.pause', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -192px 0px');
        })

        $('a.butt_pause').unbind('mousedown').bind('mousedown.pause', function() {
            var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
            var winObj = windowContainerStruct.window;
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -256px 0px');
            // 停止回放本地录像
            var operator = NPCCIF.StopReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);

            winObj.status.playvideoing = false;
            //刷新最后一帧画面
            operator = NPCCIF.RefreshImage(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            //关闭回放本地录像
            operator = NPCCIF.CloseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);

            $('a.butt_progress').slider('option', 'value', 0);
            WebQuery.hMedia = null;
            WebQuery.nTotalTime = 0;
            clearInterval(WebQuery.interval);
            WebQuery.isPauseToPlay = 1;
            // 停止输入输出音频
            // var operator = NPCCIF.SetMedia(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 0, 0, 0);
            WebQuery.playVideoFile_disabled();
            $('.butt_pauseToPlayAudioOne').css('display', 'inline-block');
            $('.butt_playOrPauseAudioOne').css('display', 'none');
            $('.butt_pauseToPlayAudioTwo').css('display', 'inline-block');
            $('.butt_playOrPauseAudioTwo').css('display', 'none');
            $('.butt_playOrPause').css('display', 'none');
            $('.butt_pauseToPlay').css('display', 'inline-block');
            $('.butt_pause').css('opacity', '0.6');
            $('.butt_slow').css('opacity', '0.6');
            $('.butt_speed').css('opacity', '0.6');
            $('.butt_pauseToPlayAudioOne').css('opacity', '0.6');
            $('.butt_pauseToPlayAudioTwo').css('opacity', '0.6');
            $('.butt_snapshot').css('opacity', '0.6');
            $('.butt_rotate').css('opacity', '0.6');
            $('.butt_fullScreen').css('opacity', '0.6');
        });

        // 慢进  可以取值：-2，-1， 0  依次表示慢进1/4、慢进1/2，正常播放
        $('a.butt_slow').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -288px 0px');
        $('a.butt_slow').bind('mouseover.slow', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -320px 0px');
        })

        $('a.butt_slow').bind('mouseout.slow', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -288px 0px');
        })

        var butt_slowNumber = 0;
        $('a.butt_slow').unbind('mousedown').bind('mousedown.slow', function() {
            butt_slowNumber--;
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -352px 0px');
            if (butt_slowNumber == 0) {
                $('.video_state').text('正在播放');
            }
            else if (butt_slowNumber == -1) {
                $('.video_state').text('慢进 × 1/' + '2');
            }
            else {
                $('.video_state').text('慢进 × 1/' + '4');
            }

            operator = NPCCIF.Replay(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 0, 0, butt_slowNumber);
            if (butt_slowNumber == -2) {
                butt_slowNumber = 1;
            }
        })

        // 快进 可以取值：0，1，2，3，4，依次表示正常播放、快进2、快进4、快进8、快进16
        $('a.butt_speed').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -384px 0px');
        $('a.butt_speed').bind('mouseover.speed', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -416px 0px');
        })

        $('a.butt_speed').bind('mouseout.speed', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -384px 0px');
        })

        var butt_speedNumber = 0;
        $('a.butt_speed').unbind('mousedown').bind('mousedown.speed', function() {
            butt_speedNumber++;
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -448px 0px');
            if (butt_speedNumber == 0) {
                $('.video_state').text('正在播放');
            }
            else if (butt_speedNumber == 1) {
                $('.video_state').text('快进 × ' + '2');
            }
            else if (butt_speedNumber == 2) {
                $('.video_state').text('快进 × ' + '4');
            }
            else if (butt_speedNumber == 3) {
                $('.video_state').text('快进 × ' + '8');
            }
            else {
                $('.video_state').text('快进 × ' + '16');
            }
            var operator = NPCCIF.Replay(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 0, 0, butt_speedNumber);
            if (butt_speedNumber == 4) {
                butt_speedNumber = -1;
            }
        })

        $('.butt_pauseToPlayAudioOne').css('display', 'none');
        $('.butt_playOrPauseAudioOne').css('display', 'inline-block');
        $('.butt_pauseToPlayAudioTwo').css('display', 'none');
        $('.butt_playOrPauseAudioTwo').css('display', 'inline-block');

        //关闭输入音频1
        $('a.butt_playOrPauseAudioOne').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -544px 0px');
        $('a.butt_playOrPauseAudioOne').unbind('mousedown').bind('mousedown.playOrPauseAudioOne', function() {
            $(this).css('display', 'none');
            $('.butt_pauseToPlayAudioOne').css('display', 'inline-block');
            // 输出音频的回放状态
            operator = NPCCIF.GetOutputAudioRenderStatus(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            operator = NPCCIF.SetMedia(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 1, 0, operator.value);
        })

        // 打开输入音频1
        $('a.butt_pauseToPlayAudioOne').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -480px 0px');
        $('a.butt_pauseToPlayAudioOne').bind('mouseover.pauseToPlayAudioOne', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -512px 0px');
        })

        $('a.butt_pauseToPlayAudioOne').bind('mouseout.pauseToPlayAudioOne', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -480px 0px');
        })

        $('a.butt_pauseToPlayAudioOne').unbind('mousedown').bind('mousedown.pauseToPlayAudioOne', function() {
            $(this).css('display', 'none');
            $('.butt_playOrPauseAudioOne').css('display', 'inline-block');
            // 输出音频的回放状态
            operator = NPCCIF.GetOutputAudioRenderStatus(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            operator = NPCCIF.SetMedia(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 1, 1, operator.value);
        })

        //关闭输出音频2
        $('a.butt_playOrPauseAudioTwo').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -640px 0px');
        $('a.butt_playOrPauseAudioTwo').unbind('mousedown').bind('mousedown.playOrPauseAudioTwo', function() {
            $(this).css('display', 'none');
            $('.butt_pauseToPlayAudioTwo').css('display', 'inline-block');
            // 输入音频的回放状态
            operator = NPCCIF.GetInputAudioRenderStatus(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            NPCCIF.SetMedia(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 1, operator.value, 0);
        })

        // 打开输出音频2
        $('a.butt_pauseToPlayAudioTwo').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -576px 0px');
        $('a.butt_pauseToPlayAudioTwo').bind('mouseover.pauseToPlayAudioTwo', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -608px 0px');
        })

        $('a.butt_pauseToPlayAudioTwo').bind('mouseout.pauseToPlayAudioTwo', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -576px 0px');
        })

        $('a.butt_pauseToPlayAudioTwo').unbind('mousedown').bind('mousedown.pauseToPlayAudioTwo', function() {
            $(this).css('display', 'none');
            $('.butt_playOrPauseAudioTwo').css('display', 'inline-block');
            // 输入音频的回放状态
            operator = NPCCIF.GetInputAudioRenderStatus(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            operator = NPCCIF.SetMedia(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 1, operator.value, 0);
        })

        // 抓拍
        $('a.butt_snapshot').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -672px 0px');
        $('a.butt_snapshot').bind('mouseover.snapshot', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -704px 0px');
        })

        $('a.butt_snapshot').bind('mouseout.snapshot', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -672px 0px');
        })

        $('a.butt_snapshot').unbind('mousedown').bind('mousedown.snapshot', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -736px 0px');
            // 抓拍
            WebQuery.LocalSnapshotVideo();
        })

        // 旋转
        $('a.butt_rotate').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -768px 0px');
        $('a.butt_rotate').bind('mouseover.rotate', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -800px 0px');
        });

        $('a.butt_rotate').bind('mouseout.rotate', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -768px 0px');
        });

        $('a.butt_rotate').unbind('mousedown').bind("mousedown.rotate", function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -832px 0px');
            operator = NPCCIF.RSTW_Rotate90(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            console.log(operator.errorCode);
        });

        // 全屏
        $('a.butt_fullScreen').css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -864px 0px');
        $('a.butt_fullScreen').bind('mouseover.fullScreen', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -896px 0px');
        });

        $('a.butt_fullScreen').bind('mouseout.fullScreen', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -864px 0px');
        });

        $('a.butt_fullScreen').unbind('mousedown').bind('mousedown.fullScreen', function() {
            $(this).css('background', 'url("Image/queryImage/PlayerList32.png") no-repeat -928px 0px');
            var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
            var winObj = windowContainerStruct.window;
            operator = NPCCIF.FullScreen(winObj.pwPlugin);
            // console.log(operator);
        });
    },

    // 回放点播录像文件按钮禁止状态
    playVideoFile_disabled: function() {
        $('.video_state').text('');
        $('.progress_time').text('');
        // 停止播放
        $('a.butt_pause').unbind('.pause');

        // 慢进 可以取值：-2，-1， 0  依次表示慢进1/4、慢进1/2，正常播放
        $('a.butt_slow').unbind('.slow');

        // 快进 可以取值：0，1，2，3，4，依次表示正常播放、快进2、快进4、快进8、快进16
        $('a.butt_speed').unbind('.speed');

        //打开音频1
        $('a.butt_playOrPauseAudioOne').unbind('.playOrPauseAudioOne');

        // 关闭音频1
        $('a.butt_pauseToPlayAudioOne').unbind('.pauseToPlayAudioOne');

        //打开音频2
        $('a.butt_playOrPauseAudioTwo').unbind('.playOrPauseAudioTwo');

        // 关闭音频2
        $('a.butt_pauseToPlayAudioTwo').unbind('.pauseToPlayAudioTwo');

        // 抓拍
        $('a.butt_snapshot').unbind('.snapshot');

        // 旋转
        $('a.butt_rotate').unbind('.rotate');

        // 全屏
        $('a.butt_fullScreen').unbind('.fullScreen');
    },

    // 点播平台前端视频文件
    playVideoInfo: function(tb_tbody) {
        var storageHandle = [];
        var thisObj = [];
        var ucIVIndex = [];
        var strLetter = [];
        var array = [];
        var videoNameArray = [];
        var equipName = [];
        var startTimeCalc = [];
        var endTimeCalc = [];
        $('#' + tb_tbody + ' tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ('0' + parseInt(x).toString(16)).slice(-2);
            }

            rgb = '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                thisObj.push($(this));
                var hrefInfo = $(this).attr('href');
                var hrefInfoRes = hrefInfo.split('&&');
                startTimeCalc.push($(this).children().eq(3).text());
                endTimeCalc.push($(this).children().eq(4).text());
                var platformOrLocalSelectText = $("#platformOrLocalSel").find("option:selected").text();
                if (platformOrLocalSelectText == '平台') {
                    storageHandle.push(hrefInfoRes[0]);
                    array.push(NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(hrefInfoRes[1])));
                    videoNameArray.push(hrefInfoRes[2]);
                    equipName.push(hrefInfoRes[3]);
                    ucIVIndex.push(hrefInfoRes[4]);
                    if (hrefInfoRes[5]) {
                        strLetter.push(hrefInfoRes[5]);
                    }

                    //需要记住信息
                    var trHrefInfo = thisObj[0] + '&&' + array[0] + '&&' + storageHandle[0] + '&&' + ucIVIndex[0] + '&&' +
                        strLetter[0] + '&&' + videoNameArray[0] + '&&' + equipName[0];

                    WebQuery.trCurObj = thisObj[0];
                    WebQuery.trHrefInfo = trHrefInfo;
                }
                else {
                    array.push(NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(hrefInfoRes[0])));
                    videoNameArray.push(hrefInfoRes[1]);
                    equipName.push(hrefInfoRes[2]);
                    //需要记住信息
                    var trHrefInfo = thisObj[0] + '&&' + array[0] + '&&' + '' + '&&' + '' + '&&' +
                        '' + '&&' + videoNameArray[0] + '&&' + equipName[0];
                    WebQuery.trCurObj = thisObj[0];
                    WebQuery.trHrefInfo = trHrefInfo;
                }

            }
        })

        WebQuery.playVideoFile(tb_tbody, thisObj[0], array[0], storageHandle[0], ucIVIndex[0], strLetter[0],
            videoNameArray[0], equipName[0], startTimeCalc[0], endTimeCalc[0]);
    },

    // 点播平台、本地视频
    playVideoFile: function(tb_tbody, thisObj, array, storageHandle, ucIVIndex, strLetter, videoNameArray, equipName,
                            startTimeCalc, endTimeCalc) {
        var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
        var winObj = windowContainerStruct.window;
        var operator;
        var platformOrLocalSelectText = $("#platformOrLocalSel").find("option:selected").text();
        // 打开回放
        if (platformOrLocalSelectText == "平台") {
            // 打开点播
            operator = NPCCIF.OpenReplayPreview(NPCCILY.Plug.ccPlugin, winObj.pwHandle, array, storageHandle,
                ucIVIndex, strLetter ? strLetter : '');
        }
        else {
            operator = NPCCIF.OpenReplayPreview(NPCCILY.Plug.ccPlugin, winObj.pwHandle, array, '', -1, '');
        }

        if (operator.errorCode == ErrorCode.NP_E_OK) {
            $('.header_videoInfo').text(videoNameArray);
            $('.header_equipName').text(equipName);
            $('.video_state').text('正在播放');
            var hMedia = operator.value;
            WebQuery.hMedia = hMedia;
            console.log('OpenReplayPreview: ' + WebQuery.hMedia);
            // 设置点播或回放参数
            operator = NPCCIF.Replay(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 0, 0, 0);
            // 启动点播或回放录像
            operator = NPCCIF.StartReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 0);
            if (operator.errorCode == 0) {
                winObj.status.playvideoing = true;
                winObj.params.mediaHandle = WebQuery.hMedia;
            }

            $('.butt_playOrPause').unbind('mousedown').bind('mousedown', function() {
                // 慢进
                $('a.butt_slow').unbind('.slow');
                // 快进
                $('a.butt_speed').unbind('.speed');
                $('.butt_slow').css('opacity', '0.6');
                $('.butt_speed').css('opacity', '0.6');

                $(this).css('display', 'none');
                $('.butt_pauseToPlay').css('display', 'inline-block');
                // 暂停回放本地录像
                operator = NPCCIF.PauseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                $('.video_state').text('暂停');

                winObj.status.playvideoing = false;
            })

            //播放
            $('.butt_pauseToPlay').unbind('mousedown').bind('mousedown', function() {
                $('.video_state').text('正在播放');
                if (WebQuery.isPauseToPlay == 1) {
                    WebQuery.playVideoFile_enabled();
                    $(this).css('display', 'none');
                    $('.butt_playOrPause').css('display', 'inline-block');
                    $('.butt_pause').css('opacity', '1');
                    $('.butt_slow').css('opacity', '1');
                    $('.butt_speed').css('opacity', '1');
                    $('.butt_pauseToPlayAudioOne').css('display', 'none');
                    $('.butt_playOrPauseAudioOne').css('display', 'inline-block');
                    $('.butt_pauseToPlayAudioTwo').css('display', 'none');
                    $('.butt_playOrPauseAudioTwo').css('display', 'inline-block');
                    $('.butt_playOrPauseAudioOne').css('opacity', '1');
                    $('.butt_playOrPauseAudioTwo').css('opacity', '1');
                    $('.butt_pauseToPlayAudioOne').css('opacity', '1');
                    $('.butt_pauseToPlayAudioTwo').css('opacity', '1');
                    $('.butt_snapshot').css('opacity', '1');
                    $('.butt_rotate').css('opacity', '1');
                    $('.butt_fullScreen').css('opacity', '1');
                    WebQuery.isPauseToPlay = 0;
                    var trHrefInfo = WebQuery.trHrefInfo.split('&&');
                    WebQuery.playVideoFile(WebQuery.tb_tbody, WebQuery.trCurObj, trHrefInfo[1], trHrefInfo[2], trHrefInfo[3],
                        trHrefInfo[4], trHrefInfo[5], trHrefInfo[6], startTimeCalc, endTimeCalc);
                }
                else {
                    WebQuery.playVideoFile_enabled();
                    $(this).css('display', 'none');
                    $('.butt_playOrPause').css('display', 'inline-block');

                    // 当前回放时间
                    operator = NPCCIF.GetVodCurTime(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                    // 启动回放本地录像
                    operator = NPCCIF.StartReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, operator.value);

                    if (operator.errorCode == 0) {
                        winObj.status.playvideoing = true;
                    }

                    $('.butt_pause').css('opacity', '1');
                    $('.butt_slow').css('opacity', '1');
                    $('.butt_speed').css('opacity', '1');
                    $('.butt_playOrPauseAudioOne').css('opacity', '1');
                    $('.butt_playOrPauseAudioTwo').css('opacity', '1');
                    $('.butt_pauseToPlayAudioOne').css('opacity', '1');
                    $('.butt_pauseToPlayAudioTwo').css('opacity', '1');
                    $('.butt_snapshot').css('opacity', '1');
                    $('.butt_rotate').css('opacity', '1');
                    $('.butt_fullScreen').css('opacity', '1');
                }
            })

            var totalTimeSecondSet = '00:00';
            var test = function() {
                operator = NPCCIF.GetVideoRenderStatus(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                if (operator.errorCode == 0 && operator.value != 2) {
                    //回放总时间
                    if (!WebQuery.nTotalTime) {
                        // 初始状态中输入音频1是打开状态
                        NPCCIF.SetMedia(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, 1, 1, 1);
                        // 获取点播总时间
                        operator = NPCCIF.GetVodTotalTime(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                        var nVodTotalTime = 0;
                        if (operator.errorCode == 0) {
                            if (operator.value == '0') {
                                nVodTotalTime = WebQuery.dateDiff(startTimeCalc, endTimeCalc);
                                if (nVodTotalTime == '0') {
                                    $('.progress_time').text('00:00'+ ' / ' + '00:00');
                                }
                            } else {
                                nVodTotalTime = parseInt(operator.value);
                            }
                        }

                        if (nVodTotalTime) {
                            totalTimeSecondSet = WebQuery.calcTime(nVodTotalTime);
                        }
                        // console.log('总时间：' + nVodTotalTime);

                        WebQuery.nTotalTime = nVodTotalTime;
                        if (!WebQuery.nTotalTime) {
                            return;
                        }

                        $('a.butt_progress').slider('option', 'max', WebQuery.nTotalTime);
                    }
                    // 当前回放时间
                    operator = NPCCIF.GetVodCurTime(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                    var nVodCurTime = parseInt(operator.value);

                    //nVodCurTime == -2接口还未获取到
                    if (nVodCurTime != -2) {
                        var curTimeSecondSet = WebQuery.calcTime(nVodCurTime);
                        $('.progress_time').text(curTimeSecondSet + ' / ' + totalTimeSecondSet);
                        var bStop = (nVodCurTime == -1) || (nVodCurTime >= WebQuery.nTotalTime);
                        if (bStop) {
                            nVodCurTime = WebQuery.nTotalTime;
                        }

                        if (nVodCurTime <= WebQuery.nTotalTime) {
                            if (WebQuery.jumpReplayPosition) {
                                $('a.butt_progress').slider('option', 'value', WebQuery.jumpReplayPosition);
                                WebQuery.jumpReplayPosition = 0;
                            }
                            else {
                                $('a.butt_progress').slider('option', 'value', nVodCurTime);
                            }
                        }

                        if (bStop) {
                            clearInterval(interval);
                            $('.video_state').text('');
                            $('.progress_time').text('');
                            WebQuery.interval = null;
                            var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
                            var winObj = windowContainerStruct.window;
                            $("a.butt_pause").css("background", "url(\"Image/queryImage/PlayerList32.png\") no-repeat -256px 0px");

                            // 停止点播或者回放录像
                            operator = NPCCIF.StopReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                            winObj.status.playvideoing = false;
                            //刷新最后一帧画面
                            operator = NPCCIF.RefreshImage(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                            $('a.butt_progress').slider('option', 'value', 0);

                            //关闭录像
                            operator = NPCCIF.CloseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                            WebQuery.hMedia = null;
                            WebQuery.nTotalTime = 0;
                            if (thisObj.next().attr('href')) {
                                var storageHandle = [];
                                var ucIVIndex = [];
                                var strLetter = [];
                                var startTimeCalcNew = [];
                                var endTimeCalcNew = [];
                                var array = [];
                                var videoNameArray = [];
                                var equipName = [];
                                var hrefInfo = thisObj.next().attr('href');
                                var hrefInfoRes = hrefInfo.split('&&');
                                startTimeCalcNew.push(thisObj.next().children().eq(3).text());
                                endTimeCalcNew.push(thisObj.next().children().eq(4).text());
                                array.push(NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(hrefInfoRes[0])));
                                videoNameArray.push(hrefInfoRes[1]);
                                equipName.push(hrefInfoRes[2]);
                                trHrefInfo = thisObj.next() + '&&' + array[0] + '&&' + '' + '&&' + '' + '&&' +
                                    '' + '&&' + videoNameArray[0] + '&&' + equipName[0];

                                WebQuery.trCurObj = thisObj.next();
                                WebQuery.trHrefInfo = trHrefInfo;

                                WebQuery.playVideoFile(tb_tbody, thisObj.next(), array[0], storageHandle[0], ucIVIndex[0],
                                    strLetter[0], videoNameArray[0], equipName[0], startTimeCalcNew[0], endTimeCalcNew[0]);
                            }
                            else {
                                WebQuery.isPauseToPlay = 1;
                                WebQuery.playVideoFile_disabled();
                                $('.butt_pauseToPlayAudioOne').css('display', 'inline-block');
                                $('.butt_playOrPauseAudioOne').css('display', 'none');
                                $('.butt_pauseToPlayAudioTwo').css('display', 'inline-block');
                                $('.butt_playOrPauseAudioTwo').css('display', 'none');
                                $('.butt_playOrPause').css('display', 'none');
                                $('.butt_pauseToPlay').css('display', 'inline-block');
                                $('.butt_pause').css('opacity', '0.6');
                                $('.butt_slow').css('opacity', '0.6');
                                $('.butt_speed').css('opacity', '0.6');
                                $('.butt_pauseToPlayAudioOne').css('opacity', '0.6');
                                $('.butt_pauseToPlayAudioTwo').css('opacity', '0.6');
                                $('.butt_snapshot').css('opacity', '0.6');
                                $('.butt_rotate').css('opacity', '0.6');
                                $('.butt_fullScreen').css('opacity', '0.6');
                            }
                        }
                    }
                }
            }

            setTimeout(test, 100);

            var interval = setInterval(test, 1000);

            WebQuery.interval = interval;
        }
        else {
            alert('回放录像文件失败，录像文件不存在或无效');
        }
    },
    // 获取俩个时间的时间差
    dateDiff: function(sDate1, sDate2) { //sDate1和sDate2是字符串 yyyy-MM-dd格式
        var aDate, oDate1, oDate2;
        aDate = sDate1.split("-");
        oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);//转换为MM-dd-yyyy格式
        aDate = sDate2.split("-");
        oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);
        var TotalMilliseconds = Math.abs(oDate1 - oDate2);//相差的毫秒数
        var TotalSeconds = parseInt(TotalMilliseconds / 1000);
        return TotalSeconds;
    },

    // 下载录像文件或者图片文件
    loadVideoOrPictureFile1: function(tb_tbody, checkOrDownload) {
        $('#' + tb_tbody + ' tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            rgb = "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr("href");
                var hrefInfoRes = hrefInfo.split('&&');
                if(!WebQuery.downloadInfoObj.hasOwnProperty(hrefInfoRes[2])) {
                    WebQuery.downloadInfoObj[hrefInfoRes[2]] = {
                        'storageHandle': hrefInfoRes[0],
                        'pathInfo': NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(hrefInfoRes[1])),
                        'equipCameraInfo': hrefInfoRes[3],
                        'ucIVIndex': hrefInfoRes[4],
                        'strLetter': hrefInfoRes[5],
                        'fileSize': hrefInfoRes[6],
                        'storDate': hrefInfoRes[7],
                        'downloadHandle': '',
                        'status': NPCCEnum.DownloadStatus.Download_Status_Unknown, // 0表示未知
                        'startOrStopStatus': NPCCEnum.FileDownloadSet.FileDownload_Set_Satrt, // 开始下载
                        'bPause': false,
                        'bStop': false,
                    };
                }
                else {
                    alert('文件已存在于下载列表中,正在下载或排队');
                }
            }
        })

        //已用秒数
        var hasSecond = 0;
        var interval = setInterval(function() {
            // console.log(WebQuery.downloadInfoObj);
            hasSecond++;
            $.each(WebQuery.downloadInfoObj, function(key, value) {
                if (value.startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Satrt) {
                    // 获取所有在表格中的视频名称
                    var videoFileArray = [];
                    $('#downloadManage_1_tbody tr td.loadVideoName').each(function() {
                        videoFileArray.push($.trim($(this).text()));
                    })
                    var strDir = 'C:\\RST_Client\\';
                    WebQuery.strDir = strDir;
                    if (videoFileArray.indexOf(key) == -1 || value.bPause || value.bStop) {
                        var path = WebQuery.strDir + value.storDate + '\\' +
                            value.equipCameraInfo.split('-')[0] + '_' + key.split('_')[0] + '_' + key.split('_')[1] + '_' + ('0000' + WebQuery.videoFileSum).substr(-4, 4) + '\\' +
                            value.equipCameraInfo.split('-')[1] + '_' + key;
                        var localPath = NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(path));
                        if (tb_tbody == 'tb_2_tbody' && checkOrDownload == 'check') {
                            WebQuery.downloadPicPath = localPath;
                        }

                        var downloadFileInfo = {
                            DownloadHandle: value.downloadHandle,// 下载句柄
                            LocalPath: localPath, // 本地存储路径，文件存在哪里
                            RemotePath: value.pathInfo, //远程文件路径，文件从哪里下载
                            DiskLetter: value.strLetter ? value.strLetter : '', // 盘符
                            FileType: 1,  // 下载文件类型 1表示录像 2表示图片
                            Status: value.status, // 下载状态 0表示未知；1表示正在下载；2表示下载完成；3表示正在合成；4表示合成完成
                            ResIdx: value.ucIVIndex, // 资源通道号，即哪个摄像头录的像
                            FileSize: value.fileSize, // 下载文件的大小，单位字节
                            UseVodMode: 0, // 点播方式下载 0表示不是 1表示是
                            StartTime: '', // 文件起始时间，点播方式为1有效
                            EndTime: '' // 文件结束时间，点播方式为1有效
                        };
                        // 启动下载
                        var operator = NPCCIF.StartDownload(NPCCILY.Plug.ccPlugin, value.storageHandle, JSON.stringify(downloadFileInfo), 15);
                        console.log('句柄' + operator.value);
                        if (operator.errorCode == 0) {
                            if (!value.bPause) {
                                value.downloadHandle = operator.value;
                            }

                            if (value.bStop) {
                                $.each(WebQuery.reStartTrcurObj, function(key1, value1) {
                                    if (key == key1) {
                                        value1.trCurobj.attr('href', value.downloadHandle + '&&' + value.pathInfo + '&&'
                                            + key+ '&&' + value.storageHandle + '&&' +  value.equipCameraInfo + '&&'
                                            + value.ucIVIndex + '&&' + value.strLetter + '&&' + value.fileSize + '&&' + value.storDate);
                                        value1.trCurobj.attr('id', value.downloadHandle);
                                    }
                                })
                            }

                            value.status = NPCCEnum.DownloadStatus.Download_Status_Loading;
                            value.startOrStopStatus = NPCCEnum.FileDownloadSet.FileDownload_Set_Downing;

                            if (!value.bPause && !value.bStop) {
                                var html = [];
                                html.push('<tr id="' + value.downloadHandle + '" href="' + value.downloadHandle + '&&' + value.pathInfo + '&&'
                                    + key + '&&' + value.storageHandle + '&&' +  value.equipCameraInfo + '&&' +  value.ucIVIndex + '&&'
                                    + value.strLetter + '&&' + value.fileSize + '&&' + value.storDate + '" ' +
                                    'onClick="WebQuery.changeIndex(\'downloadManage_1\');"  oncontextmenu="WebQuery.setButtBg()">');
                                html.push('<td class="loadStatus"><span style="display: inline-block; text-align: center; vertical-align: middle; ' +
                                    'width: 16px; height: 16px;margin-right: 3px; background: url(Image/indexImage/QueryListMenu.png) no-repeat -16px 0px;"></span></td>')
                                if (tb_tbody == 'tb_1_tbody') {
                                    html.push('<td class="loadVideoName" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerText;}">' +
                                        '<span style="display: inline-block;width: 16px; height: 16px;margin-right: 3px;vertical-align:middle;background:url(Image/indexImage/CommandList16.png) no-repeat -624px 0px;"></span>'
                                        + key + '</td>');
                                }
                                else if (tb_tbody == 'tb_2_tbody') {
                                    html.push('<td class="loadVideoName" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerText;}">' +
                                        '<span style="display: inline-block;width: 16px; height: 16px;margin-right: 3px;vertical-align:middle;background:url(Image/indexImage/CommandList16.png) no-repeat -640px 0px;"></span>'
                                        + key + '</td>');
                                }

                                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + (value.fileSize / 1024 / 1024).toFixed(1) + 'MB' + '</td>');
                                html.push('<td class="loadProgress" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">0%</td>');
                                html.push('<td class="loadSpeed" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">0B/s</td>');
                                html.push('<td class="loadTime" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">--/00:00</td>')
                                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">无</td>');
                                html.push('</tr>');
                                $('#downloadManage_1_tbody').prepend(html.join(''));

                                WebQuery.checkMore('downloadManage_1_tbody', 'downloadManage_1');
                            }

                            $('#' + value.downloadHandle +' td.loadStatus span').css('background', 'url(Image/indexImage/QueryListMenu.png) no-repeat -16px 0px;');

                            if (value.bPause) {
                                value.bPause = false;
                            }

                            if (value.bStop) {
                                value.bStop = false;
                            }
                        }
                        else {
                            alert('启动下载文件失败：' + ErrorCode.Error2Desc(operator.errorCode));
                        }
                    }
                }
                else if (value.startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Downing) {
                    //  获取下载进度V：JSON格式数据，Progress：下载进度 Total：总大小 Transfer：发送大小 TransferSizeStream：发送大小（流式）
                    var operatorLoadInfo = NPCCIF.GetDownloadProgress(NPCCILY.Plug.ccPlugin, value.downloadHandle);
                    // console.log(operatorLoadInfo.value);
                    if (operatorLoadInfo.errorCode != ErrorCode.NP_E_OK
                        && operatorLoadInfo.errorCode != ErrorCode.NP_DOWNLOAD_E_WILL_COMBINE_FILE
                        && operatorLoadInfo.errorCode != ErrorCode.NP_DOWNLOAD_E_COMBINE_FILE_COMPLETED) {
                        // 暂停下载
                        var operatorPause = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, value.downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Pause);
                    }
                    else if (operatorLoadInfo.errorCode == ErrorCode.NP_DOWNLOAD_E_COMBINE_FILE_COMPLETED) {
                        console.log('下载完成');
                        $('#' + value.downloadHandle + ' td.loadProgress').text('100%');
                        $('#' + value.downloadHandle +' td.loadStatus span').css('background', 'url(Image/indexImage/MiscList16.png) no-repeat -304px 0px;');

                        // 停止下载 nStopType {Int} [in] 停止下载类型，0表示停止下载；1表示暂停下载；2表示删除下载任务
                        var operatorStop = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, value.downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Stop);
                        value.status = NPCCEnum.DownloadStatus.Download_Status_Complete;
                        setTimeout(function() {
                            $('#' + value.downloadHandle).remove();

                            delete WebQuery.downloadInfoObj[key];

                            if (WebQuery.isEmptyObject(WebQuery.downloadInfoObj)) {
                                clearInterval(interval);
                            }
                        }, 300)

                        if (tb_tbody == 'tb_2_tbody' && checkOrDownload == 'check') {
                            var operator1 = NPCCIF.RSTW_Util_ExecuteFile(NPCCILY.Plug.ccPlugin, WebQuery.downloadPicPath);
                            WebQuery.downloadPicPath = null;
                        }
                    }
                    else {
                        operatorLoadInfo.value = [operatorLoadInfo.value];
                        if (operatorLoadInfo.value[0].Total == operatorLoadInfo.value[0].Transfer) {
                            console.log('下载完成');

                            $('#' + value.downloadHandle + ' td.loadProgress').text('100%');
                            $('#' + value.downloadHandle +' td.loadStatus span').css('background', 'url(Image/indexImage/MiscList16.png) no-repeat -304px 0px;');

                            // 停止下载 nStopType {Int} [in] 停止下载类型，0表示停止下载；1表示暂停下载；2表示删除下载任务
                            var operatorStop = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, value.downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Stop);
                            value.status = NPCCEnum.DownloadStatus.Download_Status_Complete;
                            setTimeout(function() {
                                $('#' + value.downloadHandle).remove();

                                delete WebQuery.downloadInfoObj[key];

                                if (WebQuery.isEmptyObject(WebQuery.downloadInfoObj)) {
                                    clearInterval(interval);
                                }
                            }, 300)

                            if (tb_tbody == 'tb_2_tbody' && checkOrDownload == 'check') {
                                var operator1 = NPCCIF.RSTW_Util_ExecuteFile(NPCCILY.Plug.ccPlugin, WebQuery.downloadPicPath);
                                WebQuery.downloadPicPath = null;
                            }
                        }

                        //进度
                        $('#' + value.downloadHandle + ' td.loadProgress').text(Math.round(operatorLoadInfo.value[0].Progress * 10) / 10 + '%');
                        // 速度
                        var speedCur = Math.round(operatorLoadInfo.value[0].Transfer / hasSecond / 1024 / 1024 * 100) / 100;
                        $('#' + value.downloadHandle + ' td.loadSpeed').text(speedCur + 'MB/s');
                        // 剩余时间/已用时间
                        var hasSecondSet = WebQuery.calcTime(hasSecond);
                        if (speedCur > 0) {
                            var timeRemain = Math.round((operatorLoadInfo.value[0].Total - operatorLoadInfo.value[0].Transfer) / (speedCur * 1024 * 1024));
                            var timeRemainRes = WebQuery.calcTime(timeRemain);
                            $('#' + value.downloadHandle + ' td.loadTime').text(timeRemainRes + '/' + hasSecondSet);
                        }
                        else {
                            $('#' + value.downloadHandle + ' td.loadTime').text('--/' + hasSecondSet);
                        }

                        if (value.bPause) {
                            var operatorStop = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, value.downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Pause);
                            if (operatorStop.errorCode == 0) {
                                $('#' + value.downloadHandle +' td.loadStatus span').css('background', 'url(Image/indexImage/QueryListMenu.png) no-repeat -80px 0px;');
                                value.startOrStopStatus = NPCCEnum.FileDownloadSet.FileDownload_Set_Pause;
                            }
                        }
                    }
                }
                else if (value.startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Pause) {
                    // 什么也不做
                }
                else if (value.startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Stop) {
                    // 什么也不做
                }
            })
        }, 1000)

        WebQuery.intervalLoadFile = interval;
        WebQuery.videoFileSum++;
    },

    // 下载录像文件或者图片文件
    loadVideoOrPictureFile: function(tb_tbody, checkOrLoadPhoto) {
        var dateInfoLoad;
        var hrefInfoArray = [];
        $('#' + tb_tbody + ' tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ('0' + parseInt(x).toString(16)).slice(-2);
            }
            rgb = '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);

            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr('href');
                var hrefInfoRes = hrefInfo.split('&&');
                console.log(hrefInfoRes);
                dateInfoLoad = hrefInfoRes[8];
                if (checkOrLoadPhoto == NPCCEnum.checkOrLoadPhoto.checkPhoto) {
                    hrefInfoArray.push(hrefInfoRes);
                }
                else {
                    if (!WebQuery.downloadInfoObj.hasOwnProperty(hrefInfoRes[2])) {
                        WebQuery.downloadInfoObj[hrefInfoRes[2]] = {
                            'storageHandle': hrefInfoRes[0],
                            'pathInfo': hrefInfoRes[1],
                            'equipCameraInfo': hrefInfoRes[3],
                            'ucIVIndex': hrefInfoRes[4],
                            'strLetter': hrefInfoRes[5],
                            'fileSize': hrefInfoRes[6],
                            'storDate': hrefInfoRes[7],
                            'downloadHandle': '',
                            'status': NPCCEnum.DownloadStatus.Download_Status_Unknown, // 0表示未知
                            'startOrStopStatus': NPCCEnum.FileDownloadSet.FileDownload_Set_Satrt, // 开始下载
                            'bPause': false,
                            'bStop': false,
                            'hasSecond': '0',
                        }
                    }
                    else {
                        alert('文件已存在于下载列表中,正在下载或排队');
                    }
                }
            }
        })

        if (checkOrLoadPhoto == NPCCEnum.checkOrLoadPhoto.checkPhoto) {
            if (!WebQuery.downloadInfoObj.hasOwnProperty(hrefInfoArray[0][2])) {
                WebQuery.downloadInfoObj[hrefInfoArray[0][2]] = {
                    'storageHandle': hrefInfoArray[0][0],
                    'pathInfo': hrefInfoArray[0][1],
                    'equipCameraInfo': hrefInfoArray[0][3],
                    'ucIVIndex': hrefInfoArray[0][4],
                    'strLetter': hrefInfoArray[0][5],
                    'fileSize': hrefInfoArray[0][6],
                    'storDate': hrefInfoArray[0][7],
                    'downloadHandle': '',
                    'status': NPCCEnum.DownloadStatus.Download_Status_Unknown, // 0表示未知
                    'startOrStopStatus': NPCCEnum.FileDownloadSet.FileDownload_Set_Satrt, // 开始下载
                    'bPause': false,
                    'bStop': false,
                    'hasSecond': '0',
                }
            }
            else {
                alert('文件已存在于下载列表中,正在下载或排队');
            }
        }

        //已用秒数
        // var hasSecond = 0;
        clearInterval(WebQuery.intervalLoadFile);
        var interval = setInterval(function() {
            // hasSecond++;
            $.each(WebQuery.downloadInfoObj, function(key, value) {
                if (value.startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Satrt) {
                    value.hasSecond++;
                    // 获取所有在表格中的视频名称
                    var videoFileArray = [];
                    $('#downloadManage_1_tbody tr td.loadVideoName').each(function() {
                        videoFileArray.push($.trim($(this).text()));
                    })

                    if (videoFileArray.indexOf(key) == -1 || value.bPause || value.bStop) {
                        var path = WebClient.strDir + value.storDate + '\\' +
                                value.equipCameraInfo.split('-')[0] + '_' + key.split('_')[0] + '_' +
                                key.split('_')[1] + '_' + ('0000' + WebQuery.videoFileSum).substr(-4, 4) + '\\' +
                                value.equipCameraInfo.split('-')[1] + '_' + key;

                        var localPath = NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(path));
                        if (tb_tbody == 'tb_2_tbody') {
                            WebQuery.downloadPicPath[key] = localPath;
                        }

                        var RemotePath = NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(value.pathInfo));

                        var downloadFileInfo = {
                            DownloadHandle: value.downloadHandle,// 下载句柄
                            LocalPath: localPath, // 本地存储路径，文件存在哪里
                            RemotePath: RemotePath, //远程文件路径，文件从哪里下载
                            DiskLetter: value.strLetter ? value.strLetter : '', // 盘符
                            FileType: 1,  // 下载文件类型 1表示录像 2表示图片
                            Status: value.status, // 下载状态 0表示未知；1表示正在下载；2表示下载完成；3表示正在合成；4表示合成完成
                            ResIdx: value.ucIVIndex, // 资源通道号，即哪个摄像头录的像
                            FileSize: value.fileSize, // 下载文件的大小，单位字节
                            UseVodMode: 0, // 点播方式下载 0表示不是 1表示是
                            StartTime: '', // 文件起始时间，点播方式为1有效
                            EndTime: '' // 文件结束时间，点播方式为1有效
                        };
                        // 启动下载
                        var operator = NPCCIF.StartDownload(NPCCILY.Plug.ccPlugin, value.storageHandle, JSON.stringify(downloadFileInfo), 15);
                        console.log('句柄' + operator.value);
                        if (operator.errorCode == 0) {
                            if (!value.bPause) {
                                value.downloadHandle = operator.value;
                            }

                            if (value.bStop) {
                                $.each(WebQuery.reStartTrcurObj, function(key1, value1) {
                                    if (key == key1) {
                                        value1.trCurobj.attr('href', value.downloadHandle + '&&' + value.pathInfo + '&&'
                                            + key+ '&&' + value.storageHandle + '&&' +  value.equipCameraInfo + '&&'
                                            + value.ucIVIndex + '&&' + value.strLetter + '&&' + value.fileSize + '&&' + value.storDate);
                                        value1.trCurobj.attr('id', value.downloadHandle);
                                    }
                                })
                            }

                            value.status = NPCCEnum.DownloadStatus.Download_Status_Loading;
                            value.startOrStopStatus = NPCCEnum.FileDownloadSet.FileDownload_Set_Downing;

                            if (!value.bPause && !value.bStop) {
                                var html = [];
                                html.push('<tr id="' + value.downloadHandle + '" href="' + value.downloadHandle + '&&' + value.pathInfo + '&&'
                                    + key + '&&' + value.storageHandle + '&&' +  value.equipCameraInfo + '&&' +  value.ucIVIndex + '&&'
                                    + value.strLetter + '&&' + value.fileSize + '&&' + value.storDate + '" ' +
                                    'onClick="WebQuery.changeIndex(\'downloadManage_1\');"  oncontextmenu="WebQuery.setButtBg()">');
                                html.push('<td class="loadStatus"><span style="display: inline-block; text-align: center; vertical-align: middle; ' +
                                    'width: 16px; height: 16px;margin-right: 3px;"></span></td>')
                                if (tb_tbody == 'tb_1_tbody') {
                                    html.push('<td class="loadVideoName" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerText;}">' +
                                        '<span style="display: inline-block;width: 16px; height: 16px;margin-right: 3px;vertical-align:middle;background:url(Image/indexImage/CommandList16.png) no-repeat -624px 0px;"></span>'
                                        + key + '</td>');
                                }
                                else if (tb_tbody == 'tb_2_tbody') {
                                    html.push('<td class="loadVideoName" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerText;}">' +
                                        '<span style="display: inline-block;width: 16px; height: 16px;margin-right: 3px;vertical-align:middle;background:url(Image/indexImage/CommandList16.png) no-repeat -640px 0px;"></span>'
                                        + key + '</td>');
                                }

                                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">' + WebQuery.calcFileSize(value.fileSize) + '</td>');
                                html.push('<td class="loadProgress" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">0%</td>');
                                html.push('<td class="loadSpeed" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">0B/s</td>');
                                html.push('<td class="loadTime" onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">--/00:00</td>')
                                html.push('<td onmouseover="if (this.offsetWidth < this.scrollWidth) {this.title = this.innerHTML;}">无</td>');
                                html.push('</tr>');

                                $('#downloadManage_1_tbody').prepend(html.join(''));
                                WebQuery.checkMore('downloadManage_1_tbody', 'downloadManage_1');
                            }

                            $('#' + value.downloadHandle + ' td.loadStatus span').css('background', 'url(\'Image/indexImage/QueryListMenu.png\') no-repeat -16px 0px');
                            $('.unloadMsgNum').text($('#downloadManage_1_tbody').children().length);
                            $('.unloadMsgTips_task').text('有' + $('#downloadManage_1_tbody').children().length + '个下载任务正在进行中...');

                            if (value.bPause) {
                                value.bPause = false;
                            }

                            if (value.bStop) {
                                value.bStop = false;
                            }
                        }
                        else {
                            alert('启动下载文件失败：' + ErrorCode.Error2Desc(operator.errorCode));
                        }
                    }
                }
                else if (value.startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Downing) {
                    value.hasSecond++;
                    //  获取下载进度V：JSON格式数据，Progress：下载进度, Total：总大小, Transfer：发送大小, TransferSizeStream：发送大小（流式）
                    var operatorLoadInfo = NPCCIF.GetDownloadProgress(NPCCILY.Plug.ccPlugin, value.downloadHandle);
                    if (operatorLoadInfo.errorCode != ErrorCode.NP_E_OK
                        && operatorLoadInfo.errorCode != ErrorCode.NP_DOWNLOAD_E_WILL_COMBINE_FILE
                        && operatorLoadInfo.errorCode != ErrorCode.NP_DOWNLOAD_E_COMBINE_FILE_COMPLETED) {
                        // 暂停下载
                        var operatorPause = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, value.downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Pause);
                    }
                    else if (operatorLoadInfo.errorCode == ErrorCode.NP_DOWNLOAD_E_COMBINE_FILE_COMPLETED) {
                        console.log('下载完成');
                        $('#' + value.downloadHandle + ' td.loadProgress').text('100%');
                        $('#' + value.downloadHandle +' td.loadStatus span').css('background', 'url(\'Image/indexImage/MiscList16.png\') no-repeat -304px 0px');

                        // 停止下载 nStopType {Int} [in] 停止下载类型，0表示停止下载；1表示暂停下载；2表示删除下载任务
                        var operatorStop = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, value.downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Stop);
                        value.status = NPCCEnum.DownloadStatus.Download_Status_Complete;
                        setTimeout(function() {
                            delete WebQuery.downloadInfoObj[key];
                            if (WebQuery.isEmptyObject(WebQuery.downloadInfoObj)) {
                                clearInterval(interval);
                            }

                            $('#' + value.downloadHandle).remove();
                            if ($('#downloadManage_1_tbody').children().length) {
                                $('.unloadMsgNum').text($('#downloadManage_1_tbody').children().length);
                                $('.unloadMsgTips_task').text('有' + $('#downloadManage_1_tbody').children().length + '个下载任务正在进行中...')
                            }
                            else {
                                clearInterval(WebQuery.intervalPic);
                                WebQuery.intervalPic = null;
                                $('.loadPicture1').css('display', 'none');
                                $('.loadPicture').css('display', 'inline-block');
                                $('.unloadMsgNum').text('');
                                $('.unloadMsgTips_task').text('没有正在进行的运输任务');
                            }
                        }, 300)

                        if (tb_tbody == 'tb_2_tbody' && checkOrLoadPhoto == NPCCEnum.checkOrLoadPhoto.checkPhoto) {
                            var operator = NPCCIF.RSTW_Util_ExecuteFile(NPCCILY.Plug.ccPlugin, WebQuery.downloadPicPath[key]);
                            delete WebQuery.downloadPicPath[key];
                        }
                    }
                    else {
                        operatorLoadInfo.value = [operatorLoadInfo.value];
                        if (operatorLoadInfo.value[0].Total == operatorLoadInfo.value[0].Transfer) {
                            console.log('下载完成');
                            $('#' + value.downloadHandle + ' td.loadProgress').text('100%');
                            $('#' + value.downloadHandle +' td.loadStatus span').css('background', 'url(\'Image/indexImage/MiscList16.png\') no-repeat -304px 0px');

                            // 停止下载 nStopType {Int} [in] 停止下载类型，0表示停止下载；1表示暂停下载；2表示删除下载任务
                            var operatorStop = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, value.downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Stop);
                            value.status = NPCCEnum.DownloadStatus.Download_Status_Complete;
                            setTimeout(function() {
                                $('#' + value.downloadHandle).remove();
                                if ($('#downloadManage_1_tbody').children().length) {
                                    $('.unloadMsgNum').text($('#downloadManage_1_tbody').children().length);
                                    $('.unloadMsgTips_task').text('有' + $('#downloadManage_1_tbody').children().length + '个下载任务正在进行中...')
                                }
                                else {
                                    clearInterval(WebQuery.intervalPic);
                                    WebQuery.intervalPic = null;
                                    $('.loadPicture1').css('display', 'none');
                                    $('.loadPicture').css('display', 'inline-block');
                                    $('.unloadMsgNum').text('');
                                    $('.unloadMsgTips_task').text('没有正在进行的运输任务');
                                }

                                delete WebQuery.downloadInfoObj[key];
                                if (WebQuery.isEmptyObject(WebQuery.downloadInfoObj)) {
                                    clearInterval(interval);
                                }
                            }, 300)

                            if (tb_tbody == 'tb_2_tbody' && checkOrLoadPhoto == NPCCEnum.checkOrLoadPhoto.checkPhoto) {
                                var operator = NPCCIF.RSTW_Util_ExecuteFile(NPCCILY.Plug.ccPlugin, WebQuery.downloadPicPath[key]);
                                delete WebQuery.downloadPicPath[key];
                            }
                        }

                        //进度
                        $('#' + value.downloadHandle + ' td.loadProgress').text(Math.round(operatorLoadInfo.value[0].Progress * 10) / 10 + '%');
                        // 获取存储文件系统类型
                        var operator = NPCCILY.STOR_GetFileSystemType(WebClient.connectId, value.storageHandle);

                        if (ErrorCode.CLIENT_SUCCEEDED(operator.errorCode)) {
                            if (operator.value == NPCCEnum.DiskSystemType.DiskSystemType_Stream) {
                                // 速度
                                var speedCur = Math.round(operatorLoadInfo.value[0].Transfer / value.hasSecond * 100) / 100;
                                if (Math.round(operatorLoadInfo.value[0].Transfer / value.hasSecond * 100) / 100 < 1000) {
                                    speedCur = Math.round(operatorLoadInfo.value[0].Transfer / value.hasSecond  * 100) / 100;
                                    $('#' + value.downloadHandle + ' td.loadSpeed').text(speedCur + 'KB/s');
                                }
                                else {
                                    $('#' + value.downloadHandle + ' td.loadSpeed').text(speedCur + 'MB/s');
                                }

                                // 剩余时间/已用时间
                                var hasSecondSet = WebQuery.calcTime(value.hasSecond);
                                if (speedCur > 0) {
                                    var timeRemain = Math.round((operatorLoadInfo.value[0].Total - operatorLoadInfo.value[0].Transfer) / (speedCur));
                                    var timeRemainRes = WebQuery.calcTime(timeRemain);
                                    $('#' + value.downloadHandle + ' td.loadTime').text(timeRemainRes + '/' + hasSecondSet);
                                }
                                else {
                                    $('#' + value.downloadHandle + ' td.loadTime').text('--/' + hasSecondSet);
                                }
                            }
                        }
                        else {
                            // 速度
                            var speedCur = Math.round(operatorLoadInfo.value[0].Transfer / value.hasSecond / 1024 / 1024 * 100) / 100;
                            console.log('speedCur: ' + operatorLoadInfo.value[0].Transfer / value.hasSecond);
                            if (Math.round(operatorLoadInfo.value[0].Transfer / value.hasSecond / 1024 * 100) / 100 < 1000) {
                                speedCur = Math.round(operatorLoadInfo.value[0].Transfer / value.hasSecond / 1024 * 100) / 100;
                                $('#' + value.downloadHandle + ' td.loadSpeed').text(speedCur + 'KB/s');
                            }
                            else {
                                $('#' + value.downloadHandle + ' td.loadSpeed').text(speedCur + 'MB/s');
                            }

                            // 剩余时间/已用时间
                            var hasSecondSet = WebQuery.calcTime(value.hasSecond);
                            if (speedCur > 0) {
                                var timeRemain = Math.round((operatorLoadInfo.value[0].Total - operatorLoadInfo.value[0].Transfer) / (speedCur * 1024 * 1024));
                                var timeRemainRes = WebQuery.calcTime(timeRemain);
                                $('#' + value.downloadHandle + ' td.loadTime').text(timeRemainRes + '/' + hasSecondSet);
                            }
                            else {
                                $('#' + value.downloadHandle + ' td.loadTime').text('--/' + hasSecondSet);
                            }
                        }

                        if (value.bPause) {
                            var operatorStop = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, value.downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Pause);
                            if (operatorStop.errorCode == 0) {
                                $('#' + value.downloadHandle +' td.loadStatus span').css('background', 'url(\'Image/indexImage/QueryListMenu.png\') no-repeat -80px 0px');
                                value.startOrStopStatus = NPCCEnum.FileDownloadSet.FileDownload_Set_Pause;
                            }
                        }
                    }
                }
                else if (value.startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Pause) {
                    // 什么也不做
                }
                else if (value.startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Stop) {
                    // 什么也不做
                }

                var fileSum = 0;
                var fileProressAll = 0;
                $('#downloadManage_1_tbody tr td.loadProgress').each(function() {
                    fileSum++;
                    fileProressAll += Number($(this).text().split('%')[0]);
                })
            })
        }, 1000)

        WebQuery.intervalLoadFile = interval;
        WebQuery.videoFileSum++;
    },

    // 计算时间 00:00
    calcTime: function(time) {
        var timeRes = '00:00';
        if (time < 10) {
            timeRes = '00:0' + time;
        }
        else if (time >= 10 && time < 60) {
            timeRes = '00:' + time;
        }
        else if (time >= 60 && time < 600) {
            timeRes = '0' + Math.floor(time/60) + ':' + ((time%60) > 9 ? (time%60) : '0' + (time%60));
        }
        else if (time >= 600) {
            timeRes =  Math.floor(time/60) + ':' + ((time%60) > 9 ? (time%60) : '0' + (time%60));
        }

        return timeRes;
    },

    //判断是否为空对象
    isEmptyObject: function(obj)  {
        for (var key in obj){
            return false;//返回false，不为空对象
        }
        return true;//返回true，为空对象
    },

    // 开始下载列表中正在下载的文件
    startVideoFiles: function() {
        $('#downloadManage_1_tbody tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            rgb = "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);

            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr("href");
                var hrefInfoRes = hrefInfo.split('&&');

                if (WebQuery.downloadInfoObj[hrefInfoRes[2]].startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Pause) {
                    WebQuery.downloadInfoObj[hrefInfoRes[2]].startOrStopStatus = NPCCEnum.FileDownloadSet.FileDownload_Set_Satrt;
                }
            }
        })
    },

    // 暂停下载列表中正在下载的文件
    pauseLoadVideoFiles: function() {
        var downloadHandle = null;
        $('#downloadManage_1_tbody tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            rgb = "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);

            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr("href");
                var hrefInfoRes = hrefInfo.split('&&');
                downloadHandle = hrefInfoRes[0];

                $.each(WebQuery.downloadInfoObj, function(key, value) {
                    if (key == hrefInfoRes[2]) {
                        // value.startOrStopStatus = NPCCEnum.FileDownloadSet.FileDownload_Set_Pause;
                        value.bPause = true;
                    }
                })

            }
        })
    },

    // 删除下载列表中正在下载的文件
    deleteLoadVideoFiles: function() {
        var downloadHandle = null;
        $('#downloadManage_1_tbody tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            rgb = "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);

            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr("href");
                var hrefInfoRes = hrefInfo.split('&&');
                downloadHandle = hrefInfoRes[0];

                // 删除
                var operatorDelete = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Delete);
                console.log(operatorDelete.value);
                if (operatorDelete.errorCode == ErrorCode.NP_E_OK) {
                    $(this).remove();
                    delete WebQuery.downloadInfoObj[hrefInfoRes[2]];
                    alert('删除下载文件成功');

                }
                else {
                    alert('删除下载文件失败：' + ErrorCode.Error2Desc(operatorDelete.errorCode));

                    return false;
                }
            }
        })

        if (WebQuery.isEmptyObject(WebQuery.downloadInfoObj)) {
            clearInterval(WebQuery.intervalLoadFile);
        }

    },

    // 重新开始下载列表中正在下载的文件
    reStartVideoFiles: function() {
        var downloadHandle = null;
        WebQuery.reStartTrcurObj = {};
        $('#downloadManage_1_tbody tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            rgb = "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);

            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr("href");
                var hrefInfoRes = hrefInfo.split('&&');
                if(!WebQuery.reStartTrcurObj.hasOwnProperty(hrefInfoRes[2])) {
                    WebQuery.reStartTrcurObj[hrefInfoRes[2]] = {
                        'trCurobj': $(this)
                    }
                }

                downloadHandle = hrefInfoRes[0];
                // 停止下载
                var operatorStop = NPCCIF.StopDownload(NPCCILY.Plug.ccPlugin, downloadHandle, NPCCEnum.StopDownloadType.StopDownload_Type_Stop);
                if (operatorStop.errorCode == 0) {
                    WebQuery.downloadInfoObj[hrefInfoRes[2]].startOrStopStatus = NPCCEnum.FileDownloadSet.FileDownload_Set_Stop;
                    delete WebQuery.downloadInfoObj[hrefInfoRes[2]];
                    $('#' + downloadHandle +' td.loadStatus span').css('background', 'url(Image/indexImage/MiscList16.png) no-repeat -224px 0px;');
                    $('#' + downloadHandle + ' td.loadProgress').text('0%');
                    $('#' + downloadHandle + ' td.loadSpeed').text('0B/s');
                    $('#' + downloadHandle + ' td.loadTime').text('--/00:00');
                }

                WebQuery.downloadInfoObj[hrefInfoRes[2]] = {
                    'storageHandle': hrefInfoRes[3],
                    'pathInfo': hrefInfoRes[1],
                    'equipCameraInfo': hrefInfoRes[4],
                    'ucIVIndex': hrefInfoRes[5],
                    'strLetter': hrefInfoRes[6],
                    'fileSize': hrefInfoRes[7],
                    'storDate': hrefInfoRes[8],
                    'downloadHandle': '',
                    'status': NPCCEnum.DownloadStatus.Download_Status_Unknown, // 0表示未知
                    'startOrStopStatus': NPCCEnum.FileDownloadSet.FileDownload_Set_Satrt, // 开始下载
                    'bPause': false,
                    'bStop': true,
                    'hasSecond': '0',
                };
            }
        })
    },

    // 右键下载 开始、暂停、重新开始等
    setButtBg: function() {
        var bgColorTrNumber = 0;
        $('#downloadManage_1_tbody tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            rgb = ("#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3])).toUpperCase();
            if (rgb.toUpperCase() == '#B4C9E9') {
                bgColorTrNumber++;
            }
        })

        if (bgColorTrNumber <= 1) {
            WebQuery.changeIndex('downloadManage_1');
        }

        var key = [];
        var bgColorArray = [];
        $('#downloadManage_1_tbody tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            rgb = ("#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3])).toUpperCase();
            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr("href");
                var hrefInfoRes = hrefInfo.split('&&');
                if (key.indexOf(hrefInfoRes[2]) < 0) {
                    key.push(hrefInfoRes[2]);
                }
            }

            if (bgColorArray.indexOf(rgb) < 0) {
                bgColorArray.push(rgb);
            }
        })

        if(key.length == 1) {
            var startOrStopStatus = WebQuery.downloadInfoObj[key[0]].startOrStopStatus;
        }
        else {
            var startOrStopStatusArray = [];
            for (var i = 0; i < key.length; i++) {
                var startOrStopStatusCur = WebQuery.downloadInfoObj[key[i]].startOrStopStatus;
                if (startOrStopStatusArray.indexOf(startOrStopStatusCur) < 0) {
                    startOrStopStatusArray.push(startOrStopStatusCur);
                }
            }

            if (startOrStopStatusArray.length == 1) {
                var startOrStopStatus = WebQuery.downloadInfoObj[key[0]].startOrStopStatus;
            }
            else {
                var startOrStopStatus = NPCCEnum.FileDownloadSet.FileDownload_Set_StartOrPause; // 正在下载或者是暂停下载
            }
        }

        // 开始
        $('span.download_startLeft').css('background', '#D6DBE9');
        $('span.download_startRight').css('background', '#E8E8E8');
        if (startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Satrt || startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Downing) {
            $('.download_startRightText').css('opacity', '0.5');
            $('.download_start').css("background","");
            $(".download_start").bind("mouseover", function() {
                $('span.download_startLeft').css('background', '#D6DBE9');
                $('span.download_startRight').css('background', '#E8E8E8');
            });
        }
        else {
            $('.download_startRightText').css('opacity', '1');
            $(".download_start").bind("mouseover", function() {
                $('span.download_startLeft').css('background', '');
                $('span.download_startRight').css('background', '');
                $(this).css("background", "#B4C9E9");
            });
        }

        $(".download_start").bind("mouseout", function(){
            $('span.download_startLeft').css('background', '#D6DBE9');
            $('span.download_startRight').css('background', '#E8E8E8');
        });
        $(".download_start").unbind('click').bind("click", function(){
            if ($('.download_startRightText').css('opacity') == '1') {
                WebQuery.startVideoFiles();
            }
        });

        // 暂停
        $('span.download_pauseLeft').css('background', '#D6DBE9');
        $('span.download_pauseRight').css('background', '#E8E8E8');

        if (startOrStopStatus == NPCCEnum.FileDownloadSet.FileDownload_Set_Pause) {
            $('.download_pauseRightText').css('opacity', '0.5');
            $('.download_pause').css("background","");
            $(".download_pause").bind("mouseover", function() {
                $('span.download_pauseLeft').css('background', '#D6DBE9');
                $('span.download_pauseRight').css('background', '#E8E8E8');
            });
        }
        else {
            $('.download_pauseRightText').css('opacity', '1');
            $(".download_pause").bind("mouseover", function() {
                $('span.download_pauseLeft').css('background', '');
                $('span.download_pauseRight').css('background', '');
                $(this).css("background","#B4C9E9");
            });
        }

        $(".download_pause").bind("mouseout", function(){
            $('span.download_pauseLeft').css('background', '#D6DBE9');
            $('span.download_pauseRight').css('background', '#E8E8E8');
        });
        $(".download_pause").unbind('click').bind("click", function(){
            WebQuery.pauseLoadVideoFiles();
        });

        // 删除
        $('span.download_delLeft').css('background', '#D6DBE9');
        $('span.download_delRight').css('background', '#E8E8E8');
        $(".download_del").bind("mouseover", function() {
            $('span.download_delLeft').css('background', '');
            $('span.download_delRight').css('background', '');
            $(this).css("background","#B4C9E9");
        });

        $(".download_del").bind("mouseout", function(){
            $('span.download_delLeft').css('background', '#D6DBE9');
            $('span.download_delRight').css('background', '#E8E8E8');
        });

        $(".download_del").unbind('click').bind("click", function(){
            WebQuery.deleteLoadVideoFiles();
        });

        // 重新开始
        $('span.download_reStartLeft').css('background', '#D6DBE9');
        $('span.download_reStartRight').css('background', '#E8E8E8');

        $(".download_reStart").bind("mouseover", function() {
            $('span.download_reStartLeft').css('background', '');
            $('span.download_reStartRight').css('background', '');
            $(this).css("background","#B4C9E9");
        });

        $(".download_reStart").bind("mouseout", function(){
            $('span.download_reStartLeft').css('background', '#D6DBE9');
            $('span.download_reStartRight').css('background', '#E8E8E8');
        });
        $(".download_reStart").unbind('click').bind("click", function(){
            WebQuery.reStartVideoFiles();
        });

        var menu = document.querySelector("#load_menu");
        var downloadManage_1 = document.querySelector("#downloadManage_1_tbody");
        downloadManage_1.addEventListener("contextmenu", function (event) {
            event.preventDefault();
            menu.style.display = "block";
            menu.style.left = event.pageX + "px";
            menu.style.top = event.pageY + "px";
        });

        $(window).on('click', function() {
            menu.style.display = "none";
        })

        document.addEventListener("contextmenu", function (event) {
            var downloadManage_1_tbodyHeight = $('#downloadManage_1_tbody').height();
            var downloadManage_1_tbodyWidth = $('#downloadManage_1_tbody').width();
            var distanceX = Math.abs(event.pageX - $('#downloadManage_1_tbody').offset().left);
            var distanceY = Math.abs(event.pageY - $('#downloadManage_1_tbody').offset().top);
            if (distanceX > downloadManage_1_tbodyWidth || distanceY > downloadManage_1_tbodyHeight) {
                menu.style.display = "none";
            }
        });
    },

    // 右键：回放查看下载上传删除
    rightButton: function(event, tb_tbody, tb, statusJudge) {
        var bgColorTrNumber = 0;
        $('#' + tb_tbody + ' tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            rgb = ("#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3])).toUpperCase();
            if (rgb.toUpperCase() == '#B4C9E9') {
                bgColorTrNumber++;
            }
        })

        if (bgColorTrNumber <= 1) {
            WebQuery.changeIndex(tb);
        }

        var menu = document.querySelector("#tb_menu");
        menu.style.display = "block";
        event.preventDefault();
        menu.style.display = "block";
        menu.style.left = event.pageX + "px";
        menu.style.top = event.pageY + "px";
        $('span.tb_callbackLeft').css('background', '#D6DBE9');
        $('span.tb_callbackRight').css('background', '#E8E8E8');

        // 视频回放或图片查看
        if (tb_tbody == 'tb_1_tbody') {
            $('span.tb_callbackRightText').text('回放');
        }
        else if (tb_tbody == 'tb_2_tbody') {
            $('span.tb_callbackRightText').text('查看');
        }

        $(".tb_callback").bind("mouseover", function() {
            $('span.tb_callbackLeft').css('background', '');
            $('span.tb_callbackRight').css('background', '');
            $(this).css("background","#B4C9E9");
        });

        $(".tb_callback").bind("mouseout", function() {
            $('span.tb_callbackLeft').css('background', '#D6DBE9');
            $('span.tb_callbackRight').css('background', '#E8E8E8');
        });

        if (tb_tbody == 'tb_1_tbody') {
            $('div.tb_callback').unbind('click').bind('click.local', function() {
                // 创建滚动条
                // createProgress();
                // 视频回放
                if ($('#dragVideo').css('display') == 'block') {
                    if (WebQuery.hMedia != null) {
                        var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
                        var winObj = windowContainerStruct.window;
                        // 停止回放本地录像
                        var operator1 = NPCCIF.StopReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                        winObj.status.playvideoing = false;
                        //刷新最后一帧画面
                        var operator3 = NPCCIF.RefreshImage(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                        //关闭回放本地录像
                        var operator8 = NPCCIF.CloseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
                        WebQuery.nTotalTime = 0;
                        WebQuery.hMedia = null;
                    }

                    $('a.butt_progress').slider('option', 'value', 0);
                    $('.butt_playOrPause').css('display', 'inline-block');
                    $('.butt_pauseToPlay').css('display', 'none');
                    $('.butt_pause').css('opacity', '1');
                    $('.butt_slow').css('opacity', '1');
                    $('.butt_speed').css('opacity', '1');
                    $('.butt_pauseToPlayAudioOne').css('display', 'none');
                    $('.butt_playOrPauseAudioOne').css('display', 'inline-block');
                    $('.butt_pauseToPlayAudioTwo').css('display', 'none');
                    $('.butt_playOrPauseAudioTwo').css('display', 'inline-block');
                    $('.butt_playOrPauseAudioOne').css('opacity', '1');
                    $('.butt_playOrPauseAudioTwo').css('opacity', '1');
                    $('.butt_pauseToPlayAudioOne').css('opacity', '1');
                    $('.butt_pauseToPlayAudioTwo').css('opacity', '1');
                    $('.butt_snapshot').css('opacity', '1');
                    $('.butt_rotate').css('opacity', '1');
                    $('.butt_fullScreen').css('opacity', '1');
                }

                $('#dragVideo').css('display', 'block');
                WebQuery.windowContainers.set('content_videoPlay', new NPCCStruct.WindowContainerStruct('content_videoPlay', false, null, null));
                WebQuery.createVideoWindow('content_videoPlay');
                WebQuery.callBackVideoResize();
                WebQuery.playVideoFile_enabled();
                WebQuery.tb_tbody = tb_tbody;
                WebQuery.nTotalTime = 0;
                clearInterval(WebQuery.interval);
                WebQuery.playVideoInfo(tb_tbody);
            })
        }
        else if (tb_tbody == 'tb_2_tbody') {
            var platformOrLocalSelectText = $("#platformOrLocalSel").find("option:selected").text();
            if (platformOrLocalSelectText == '平台') {
                $('div.tb_callback').unbind('click').bind('click', function() {
                    //先下载再打开
                    WebQuery.loadVideoOrPictureFile(tb_tbody, NPCCEnum.checkOrLoadPhoto.checkPhoto);
                })
            }
            else {
                $('div.tb_callback').unbind('click').bind('click', function() {
                    // 查看图片
                    var picPathArray = [];
                    $('#' + tb_tbody + ' tr').each(function() {
                        var rgb = $(this).css('background-color');
                        rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
                        function hex(x) {
                            return ('0' + parseInt(x).toString(16)).slice(-2);
                        }
                        rgb = '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);

                        if (rgb.toUpperCase() == '#B4C9E9') {
                            //获取有背景颜色的tr
                            var hrefInfo = $(this).attr('href');
                            var hrefInfoRes = hrefInfo.split('&&');
                            var strPath = hrefInfoRes[0];
                            picPathArray.push(NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strPath)));
                        }
                    })

                    var operator = NPCCIF.RSTW_Util_ExecuteFile(NPCCILY.Plug.ccPlugin, picPathArray[0]);
                })
            }
        }

        // 下载
        $('span.tb_downloadLeft').css('background', '#D6DBE9');
        $('span.tb_downloadRight').css('background', '#E8E8E8');
        if (tb_tbody == 'tb_1_tbody' || tb_tbody == 'tb_2_tbody') {
            var platformOrLocalSelectText = $("#platformOrLocalSel").find("option:selected").text();
            if (platformOrLocalSelectText == "平台") {
                $('.tb_downloadRightText').css('opacity', '1');
                $('.tb_download').bind('mouseover', function() {
                    $('span.tb_downloadLeft').css('background', '');
                    $('span.tb_downloadRight').css('background', '');
                    $(this).css('background', '#B4C9E9');
                });
                $('div.tb_download').unbind('click').bind('click', function() {
                    WebQuery.tb_tbody = tb_tbody;
                    WebQuery.loadVideoOrPictureFile(tb_tbody);
                })
            }
            else {
                // 本地不支持下载
                $('.tb_downloadRightText').css('opacity', '0.5');
                $('.tb_download').css('background', '');
                $(".tb_download").bind("mouseover", function(){
                    $('span.tb_downloadLeft').css('background', '#D6DBE9');
                    $('span.tb_downloadRight').css('background', '#E8E8E8');
                });

                $('div.tb_download').unbind('click')
            }

            $('.tb_download').bind('mouseout', function() {
                $('span.tb_downloadLeft').css('background', '#D6DBE9');
                $('span.tb_downloadRight').css('background', '#E8E8E8');
            });

        }

        // 删除
        $('span.tb_deleteLeft').css('background', '#D6DBE9');
        $('span.tb_deleteRight').css('background', '#E8E8E8');

        if (tb_tbody == 'tb_1_tbody' || tb_tbody == 'tb_2_tbody') {
            $('.tb_deleteRightText').css('opacity', '1');
            $(".tb_delete").bind("mouseover", function() {
                $('span.tb_deleteLeft').css('background', '');
                $('span.tb_deleteRight').css('background', '');
                $(this).css("background","#B4C9E9");
            })
        }

        $(".tb_delete").bind("mouseout", function(){
            $('span.tb_deleteLeft').css('background', '#D6DBE9');
            $('span.tb_deleteRight').css('background', '#E8E8E8');
        });

        if (tb_tbody == 'tb_1_tbody' || tb_tbody == 'tb_2_tbody') {
            $('div.tb_delete').unbind('click').bind('click', function() {
                if ($('.tb_deleteRightText').css('opacity') == '1') {
                    var platformOrLocalSelectText = $("#platformOrLocalSel").find("option:selected").text();
                    if (platformOrLocalSelectText == "平台") {
                        // 删除平台下指定的存储文件
                        WebQuery.deleteStorageFiles(tb_tbody);
                    }
                    else {
                        //删除本地指定的存储文件
                        WebQuery.deleteFiles(tb_tbody);
                    }
                }
            })
        }


        $(window).on('click', function() {
            menu.style.display = "none";
        })
    },

    // 删除平台下指定的存储文件
    deleteStorageFiles: function(tb_tbody) {
        var storageHandle = null;
        var array = [];
        var trObjArray = [];
        $('#' + tb_tbody + ' tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ('0' + parseInt(x).toString(16)).slice(-2);
            }

            rgb = '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);

            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr('href');
                var hrefInfoRes = hrefInfo.split('&&');
                storageHandle = hrefInfoRes[0];
                var strPath = hrefInfoRes[1];
                trObjArray.push($(this));
                array.push(NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(strPath)));
            }
        })

        if (array.length) {
            var operator = NPCCILY.OSS_DeleteStorageFiles(WebClient.connectId, storageHandle, array);
            console.log(operator);
            if (operator.errorCode == ErrorCode.NP_E_OK) {
                for (var i = 0; i < trObjArray.length; i++) {
                    trObjArray[i].remove();
                }
                alert('删除平台存储文件成功');
            }
            else {
                alert('删除平台存储文件失败：' + ErrorCode.Error2Desc(operator.errorCode));
                return false;
            }
        }
    },

    // 删除本地指定的存储文件
    deleteFiles: function(tb_tbody) {
        var array = [];
        var trObjArray = [];
        $('#' + tb_tbody + ' tr').each(function() {
            var rgb = $(this).css('background-color');
            rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            function hex(x) {
                return ('0' + parseInt(x).toString(16)).slice(-2);
            }
            rgb = '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
            if (rgb.toUpperCase() == '#B4C9E9') {
                //获取有背景颜色的tr
                var hrefInfo = $(this).attr('href');
                var hrefInfoRes = hrefInfo.split('&&');
                trObjArray.push($(this));
                array.push(NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(hrefInfoRes[0])));
            }
        })

        if (array.length) {
            var operator = NPCCIF.Util_DeleteFiles(NPCCILY.Plug.ccPlugin, array);
            console.log(operator);
            if (operator.errorCode == ErrorCode.NP_E_OK) {
                for (var i = 0; i < trObjArray.length; i++) {
                    trObjArray[i].remove();
                }

                alert('删除本地存储文件成功');
            }
            else {
                alert('删除本地存储文件失败：' + ErrorCode.Error2Desc(operator.errorCode));
                return false;
            }
        }
    },


    byId: function(id) {
        return typeof id === "string" ? document.getElementById(id) : id
    },

    byClass: function(sClass, oParent) {
        var aClass = [];
        var reClass = new RegExp("(^| )" + sClass + "( |$)");
        var aElem = this.byTagName("*", oParent);
        for (var i = 0; i < aElem.length; i++) reClass.test(aElem[i].className) && aClass.push(aElem[i]);
        return aClass
    },

    byTagName: function(elem, obj) {
        return (obj || document).getElementsByTagName(elem)
    },

    // 拖拽函数
    drag: function(oDrag, handle) {
        var disX = 0;
        var disY = 0;
        var oClose = WebQuery.byClass("dragVideo_close", oDrag)[0];
        handle = handle || oDrag;
        handle.style.cursor = "move";
        handle.onmousedown = function (event) {
            var event = event || window.event;
            disX = event.clientX - oDrag.offsetLeft;
            disY = event.clientY - oDrag.offsetTop;

            document.onmousemove = function (event) {
                var event = event || window.event;
                var iL = event.clientX - disX;
                var iT = event.clientY - disY;
                var maxL = document.documentElement.clientWidth - oDrag.offsetWidth;
                var maxT = document.documentElement.clientHeight - oDrag.offsetHeight;

                iL <= 0 && (iL = 0);
                iT <= 0 && (iT = 0);
                iL >= maxL && (iL = maxL);
                iT >= maxT && (iT = maxT);

                oDrag.style.left = iL + "px";
                oDrag.style.top = iT + "px";

                return false
            };

            document.onmouseup = function () {
                document.onmousemove = null;
                document.onmouseup = null;
                // this.releaseCapture && this.releaseCapture()
            };

            // this.setCapture && this.setCapture();
            return false
        };
        oClose.onclick = function () {
            var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
            var winObj = windowContainerStruct.window;
            // 停止回放本地录像
            var operator1 = NPCCIF.StopReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            winObj.status.playvideoing = false;
            //刷新最后一帧画面
            var operator3 = NPCCIF.RefreshImage(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            //关闭回放本地录像
            var operator8 = NPCCIF.CloseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            WebQuery.nTotalTime = 0;
            WebQuery.hMedia = null;
            clearInterval(WebQuery.interval);
            $('a.butt_progress').slider('option', 'value', 0);
            //销毁该进度条
            // destroyProgress();
            oDrag.style.display = "none";
            $('.butt_playOrPause').css('display', 'inline-block');
            $('.butt_pauseToPlay').css('display', 'none');
            $('.butt_pause').css('opacity', '1');
            $('.butt_slow').css('opacity', '1');
            $('.butt_speed').css('opacity', '1');
            $('.butt_pauseToPlayAudioOne').css('display', 'none');
            $('.butt_playOrPauseAudioOne').css('display', 'inline-block');
            $('.butt_pauseToPlayAudioTwo').css('display', 'none');
            $('.butt_playOrPauseAudioTwo').css('display', 'inline-block');
            $('.butt_playOrPauseAudioOne').css('opacity', '1');
            $('.butt_playOrPauseAudioTwo').css('opacity', '1');
            $('.butt_pauseToPlayAudioOne').css('opacity', '1');
            $('.butt_pauseToPlayAudioTwo').css('opacity', '1');
            $('.butt_snapshot').css('opacity', '1');
            $('.butt_rotate').css('opacity', '1');
            $('.butt_fullScreen').css('opacity', '1');

        };

        //阻止冒泡
        oClose.onmousedown = function (event) {
            this.onfocus = function () {this.blur()};
            (event || window.event).cancelBubble = true
        };
    },

    // 改变大小函数
    resize: function(oParent, handle, isLeft, isTop, lockX, lockY) {
        handle.onmousedown = function (event) {
            var event = event || window.event;
            var disX = event.clientX - handle.offsetLeft;
            var disY = event.clientY - handle.offsetTop;
            var iParentTop = oParent.offsetTop;
            var iParentLeft = oParent.offsetLeft;
            var iParentWidth = oParent.offsetWidth;
            var iParentHeight = oParent.offsetHeight;

            document.onmousemove = function (event) {
                var event = event || window.event;

                var iL = event.clientX - disX;
                var iT = event.clientY - disY;
                var maxW = document.documentElement.clientWidth - oParent.offsetLeft - 2;
                var maxH = document.documentElement.clientHeight - oParent.offsetTop - 2;
                var iW = isLeft ? iParentWidth - iL : handle.offsetWidth + iL;
                var iH = isTop ? iParentHeight - iT : handle.offsetHeight + iT;

                isLeft && (oParent.style.left = iParentLeft + iL + "px");
                isTop && (oParent.style.top = iParentTop + iT + "px");

                iW < WebQuery.dragMinWidth && (iW = WebQuery.dragMinWidth);
                iW > maxW && (iW = maxW);
                lockX || (oParent.style.width = iW + "px");

                iH < WebQuery.dragMinHeight && (iH = WebQuery.dragMinHeight);
                iH > maxH && (iH = maxH);
                lockY || (oParent.style.height = iH + "px");

                $('.dragVideo_content').css('height', ($('#dragVideo').height() - 96) + 'px');
                $('#content_videoPlay').css('height', ($('#dragVideo').height() - 96) + 'px');

                if((isLeft && iW == WebQuery.dragMinWidth) || (isTop && iH == WebQuery.dragMinHeight)) document.onmousemove = null;

                return false;
            };
            document.onmouseup = function () {
                document.onmousemove = null;
                document.onmouseup = null;
            };
            return false;
        }
    },

    callBackVideoResize:function () {
        var oDrag = document.getElementById("dragVideo");
        var oTitle = WebQuery.byClass("dragVideo_header", oDrag)[0];
        var oL = WebQuery.byClass("resizeL", oDrag)[0];
        var oT = WebQuery.byClass("resizeT", oDrag)[0];
        var oR = WebQuery.byClass("resizeR", oDrag)[0];
        var oB = WebQuery.byClass("resizeB", oDrag)[0];
        var oLT = WebQuery.byClass("resizeLT", oDrag)[0];
        var oTR = WebQuery.byClass("resizeTR", oDrag)[0];
        var oBR = WebQuery.byClass("resizeBR", oDrag)[0];
        var oLB = WebQuery.byClass("resizeLB", oDrag)[0];

        WebQuery.drag(oDrag, oTitle);
        //四角
        WebQuery.resize(oDrag, oLT, true, true, false, false);
        WebQuery.resize(oDrag, oTR, false, true, false, false);
        WebQuery.resize(oDrag, oBR, false, false, false, false);
        WebQuery.resize(oDrag, oLB, true, false, false, false);
        //四边
        WebQuery.resize(oDrag, oL, true, false, false, true);
        WebQuery.resize(oDrag, oT, false, true, true, false);
        WebQuery.resize(oDrag, oR, false, false, false, true);
        WebQuery.resize(oDrag, oB, false, false, true, false);

        oDrag.style.left = (document.documentElement.clientWidth - oDrag.offsetWidth) / 2 + "px";
        oDrag.style.top = (document.documentElement.clientHeight - oDrag.offsetHeight) / 2 + "px";

        // var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
        // if (windowContainerStruct) {
        //     var winObj = windowContainerStruct.window;
        //     NPCCILY.ResizeWindowDimension(winObj, '100%', '100%');
        //     NPCCIF.SetRenderWnd(NPCCILY.Plug.ccPlugin, winObj.params.mediaHandle, winObj.pwHandle);
        // }

    },

    // 设置音量是最小
    volumeMin: function() {
        $( "a.butt_volumeControl" ).slider({
            value: 0
        })
        $( "a.butt_volumeControl" ).attr('title', 0 );
    },

    // 设置音量是最大
    volumeMax: function() {
        $( "a.butt_volumeControl" ).slider({
            value: 100
        })
        $( "a.butt_volumeControl" ).attr('title', 100 );
    },

    // 创建窗口: 视频播放窗口
    createVideoWindow: function(key) {
        var windowContainerStruct = WebQuery.windowContainers.get(key);
        if (windowContainerStruct) {
            // 创建窗口
            var window = NPCCILY.CreateWindow(WebClient.connectId, windowContainerStruct.container);
            if (window.errorCode == ErrorCode.NP_E_OK) {
                windowContainerStruct.window = window.value;
                var windowEvent = new NPCCStruct.WindowEventStruct();
                // 左键单击事件
                windowEvent.lbtn_click.status = true;
                windowEvent.lbtn_click.callback = function (notify) {
                    WebClient.ReceivePWEvent(notify);
                };
                NPCCILY.WindowAttachEvent.Init(windowContainerStruct.window, windowEvent);

                var windowEvent2 = new NPCCStruct.WindowEventStruct();
                // 全屏窗口显示
                windowEvent2.full_screen_window_show.status = true;
                windowEvent2.full_screen_window_show.callback = function (notify) {
                    WebClient.ReceivePWEvent(notify);
                };
                NPCCILY.WindowAttachEvent.Init(windowContainerStruct.window, windowEvent2);

                var windowEvent3 = new NPCCStruct.WindowEventStruct();
                // 全屏窗口隐藏
                windowEvent3.full_screen_window_hide.status = true;
                windowEvent3.full_screen_window_hide.callback = function (notify) {
                    WebClient.ReceivePWEvent(notify);
                };
                NPCCILY.WindowAttachEvent.Init(windowContainerStruct.window, windowEvent3);
            }
        }
    },

    // 切换到别的页面，隐藏回放的视频窗口
    visibleVideo: function() {
        var windowContainerStruct = WebQuery.windowContainers.get('content_videoPlay');
        var winObj = windowContainerStruct.window;
        // 停止回放本地录像
        var operator1 = NPCCIF.StopReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
        winObj.status.playvideoing = false;
        //刷新最后一帧画面
        var operator3 = NPCCIF.RefreshImage(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
        //关闭回放本地录像
        var operator8 = NPCCIF.CloseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
        WebQuery.nTotalTime = 0;
        WebQuery.hMedia = null;
        $('#dragVideo').css('display', 'none');
        $('.butt_playOrPause').css('display', 'inline-block');
        $('.butt_pauseToPlay').css('display', 'none');
        $('.butt_pause').css('opacity', '1');
        $('.butt_slow').css('opacity', '1');
        $('.butt_speed').css('opacity', '1');
        $('.butt_pauseToPlayAudioOne').css('display', 'none');
        $('.butt_playOrPauseAudioOne').css('display', 'inline-block');
        $('.butt_pauseToPlayAudioTwo').css('display', 'none');
        $('.butt_playOrPauseAudioTwo').css('display', 'inline-block');
        $('.butt_playOrPauseAudioOne').css('opacity', '1');
        $('.butt_playOrPauseAudioTwo').css('opacity', '1');
        $('.butt_pauseToPlayAudioOne').css('opacity', '1');
        $('.butt_pauseToPlayAudioTwo').css('opacity', '1');
        $('.butt_snapshot').css('opacity', '1');
        $('.butt_rotate').css('opacity', '1');
        $('.butt_fullScreen').css('opacity', '1');
    },

    // 点击查询回放
    queryClick: function() {
        WebPreview.removePlaybackWindow();
        var platformOrLocalSelectText = $("#platformOrLocalSel").find("option:selected").text();
        var viewOrPhotoSelectText = $("#viewOrPhotoSel").find("option:selected").text();
        if (platformOrLocalSelectText == "平台") {
            if (viewOrPhotoSelectText == '录像') {
                $('#dateInfoPhotoTree').css('display', 'none');
                $('#dateInfoVideoTree').css('display', 'none');
                $('#dateInfoPlatTree').css('display', 'block');
                $('.dateInfoPhotoTb').css('display', 'none');
                $('.dateInfoVideoTb').css('display', 'block');
            }
            else if (viewOrPhotoSelectText == '图片') {
                $('#dateInfoPhotoTree').css('display', 'none');
                $('#dateInfoVideoTree').css('display', 'none');
                $('#dateInfoPlatTree').css('display', 'block');
                $('.dateInfoVideoTb').css('display', 'none');
                $('.dateInfoPhotoTb').css('display', 'block');
            }
        }
        else {
            if (viewOrPhotoSelectText == '录像') {
                $('#dateInfoPhotoTree').css('display', 'none');
                $('#dateInfoVideoTree').css('display', 'block');
                $('#dateInfoPlatTree').css('display', 'none');
                $('.dateInfoPhotoTb').css('display', 'none');
                $('.dateInfoVideoTb').css('display', 'block');
                if (WebPreview.isOrNotLocalRecord == 1) {
                    $('#dateInfoVideoTree').html('');
                    $('#tb_1_tbody').html('');
                    //本地录像树
                    WebQuery.localVideoDateInfo([], WebClient.strDir);
                    WebPreview.isOrNotLocalRecord = 0;
                }
            }
            else if (viewOrPhotoSelectText == '图片') {
                $('#dateInfoPhotoTree').css('display', 'block');
                $('#dateInfoVideoTree').css('display', 'none');
                $('#dateInfoPlatTree').css('display', 'none');
                $('.dateInfoVideoTb').css('display', 'none');
                $('.dateInfoPhotoTb').css('display', 'block');
                if (WebPreview.isOrNotLocalSnapshot == 1) {
                    $('#dateInfoPhotoTree').html('');
                    $('#tb_2_tbody').html('');
                    //本地图片树
                    WebQuery.localPhotoDateInfo([], WebClient.strDir);
                    WebPreview.isOrNotLocalSnapshot = 0;
                }
            }
        }
    },

    // 文件单击改变背景颜色
    changeIndex: function(id) {
        var oObj = window.event.srcElement;
        if (oObj.tagName.toLowerCase() == "td") {
            var oTr = oObj.parentNode;
            var res = document.getElementById(id);
            for(var i = 1; i <= $('#' + id + ' tbody').children().length; i++)   {
                res.rows[i].style.backgroundColor =  "";
            }
            oTr.style.backgroundColor = "#B4C9E9";
            oTr.tag = true;
        }

    },

    //回放视频抓拍
    LocalSnapshotVideo: function() {
        try {
            var key = 'content_videoPlay';
            var windowContainerStruct = WebQuery.windowContainers.get(key);
            if (windowContainerStruct && windowContainerStruct.window) {
                if (windowContainerStruct.window.status.playvideoing) {
                    var date = new Date();
                    var month = date.getMonth() + 1;
                    month = month < 10 ? '0' + month : '' + month;
                    var yearMonth = (date.getFullYear() + '').slice(2, 4).concat(month);
                    var day = date.getDate();
                    day = day < 10 ? '0' + day : '' + day;
                    var nameInfo = $('.header_equipName').text();
                    var saveFileDir="C:/RST_Client/Storage/" + yearMonth + "/" + day + "/" + nameInfo.split('-')[0] + '_' + NPCCUtils.DateFormat("yyyy#MM#dd#_#HH#mm#ss#_#l").replace(/#/g, "");

                    var saveFileName = nameInfo.split('-')[1] + '_' + NPCCUtils.DateFormat("yyyy#MM#dd#_#HH#mm#ss#_#l").replace(/#/g, "")+ ".bmp";
                    var saveAsFilePath = saveFileDir + "/" + saveFileName;
                    var operator = NPCCILY.Snapshot(windowContainerStruct.window, NPCCUtils.encodeUnicode(NPCCUtils.UnicodetoUTF8(saveAsFilePath)));
                    if (operator.errorCode == ErrorCode.NP_E_OK) {
                        alert('本地抓拍成功');
                    }
                    else {
                        alert('本地抓拍失败');

                        return false;
                    }
                }
                else {
                    alert('本地抓拍失败，请检查视频是否处于播放状态');

                    return false;
                }
            }
        }
        catch (e) {
            alert('本地抓拍异常：' + e.name + '::' + e.message);
        }
    },

    // 文件多选处理
    checkMore: function(tb_tbody, tb) {
        var flag = false;//是否开启拖拽的标志
        //鼠标按下
        $('#'+ tb_tbody + ' tr').mousedown(function(event) {
            if (event.button == 0){
                flag = true;
                WebQuery.changeIndex(tb);
                event.preventDefault(); // 阻止默认行为
                event.stopPropagation(); // 阻止事件冒泡
            }

        });

        //鼠标移动
        $('#'+ tb_tbody + ' tr').mousemove(function(event) {
            event.preventDefault(); // 阻止默认行为
            event.stopPropagation(); // 阻止事件冒泡
            if (!flag) {
                return;//只有开启了拖拽，才进行mouseover操作
            }
            $(this).css('background', '#B4C9E9');
        });

        //鼠标抬起
        $('#'+ tb_tbody + ' tr').mouseup(function(event) {
            event.preventDefault(); // 阻止默认行为
            event.stopPropagation(); // 阻止事件冒泡
            flag = false;
        })
    },

}


// 进度条
function createProgress() {
    $('a.butt_progress').slider({
        value: 0,
        orientation: "horizontal",
        min: 0,
        max: 100,
        range: "min",
        animate: true,
        // slide: function( event, ui) {
        //     if (WebQuery.isPauseToPlay == 1) {
        //         return;
        //     }
        //     // 跳到指定位置继续播放
        //     var operator = NPCCIF.JumpReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, ui.value);
        //     if (operator.errorCode == ErrorCode.NP_E_OK) {
        //         WebQuery.jumpReplayPosition = ui.value;
        //         console.log('跳到指定位置成功');
        //     }
        //     else {
        //         console.log(operator.errorCode + '：跳到指定位置失败');
        //     }
        //
        //     if ($('.butt_playOrPause').css('display') == 'none') {
        //         var operator3 = NPCCIF.PauseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
        //     }
        //
        // },

        stop: function( event, ui) {
            if (WebQuery.isPauseToPlay == 1) {
                return;
            }

            // 跳到指定位置继续播放
            var operator = NPCCIF.JumpReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia, ui.value);
            if (operator.errorCode == ErrorCode.NP_E_OK) {
                WebQuery.jumpReplayPosition = ui.value;
                console.log('跳到指定位置成功');
            }
            else {
                console.log(operator.errorCode + '：跳到指定位置失败');
            }

            if ($('.butt_playOrPause').css('display') == 'none') {
                var operator3 = NPCCIF.PauseReplayPreview(NPCCILY.Plug.ccPlugin, WebQuery.hMedia);
            }

        },
    });
}

createProgress();

//销毁该进度条
function destroyProgress() {
    $( "a.butt_progress" ).slider('destroy');
}

//音量
$( "a.butt_volumeControl" ).slider({
    value: 50,
    orientation: "horizontal",
    min: 0,
    max: 100,
    range: "min",
    animate: true,
    slide: function( event, ui) {
        $( "a.butt_volumeControl" ).attr('title', ui.value );
    }
});